Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
I want to reflect real time changed user nickname when chatting?

The previous chat data contains the pre-change nickname, so it is not reflected in real time when changing the nickname. What method should I use to make the nickname change in real time even the chat before changing the nickname?.

Do I have to change the nickname information in the chat data every time I change my nickname?

Firebase.usersRef
  .doc(Firebase.currentUser.email)
  .update({'nickname': nickname})
  .then(() ⇒ {
    Firebase.chatsRef
      .where('user.name', '==', Firebase.currentUser.email)
      .get()
      .then((querySnapshot) ⇒ {
        querySnapshot.forEach(doc ⇒ 
          // Changing the nickname
        )
      })
  })
  .catch(err => console.log(err));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should identify the user for each chat message by a so-called stable identifier, which apparently their nickname is not in your case.

Given that you seem to be using Firebase Authentication, the most common stable identifier for a user is their UID, which you can get with Firebase.currentUser.uid. So in addition to the nickname for the user, also store their UID in each document. Then use the UID for selecting the messages for a user, and use the nickname only to display in the UI,

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!