Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda