DEV Community

Discussion on: A Chat Progressive Web App

Collapse
 
aditbharadwaj profile image
Adit Bharadwaj • Edited

Hey i wanted to ask how did you implemented the unread messages badge count was it on the firebase functions or u did that in the front end side ? i will be glad if u can explain that thank you :)

Collapse
 
aladinyo profile image
aladinyo

yes of course I will,
In the backend each user has an unreadMessages field in each document in their chats collection and when you send a message to a user this field will be incremented and if the user sees the message it will become 0.

Collapse
 
aladinyo profile image
aladinyo

Also there is a snapshot listener to listen for this field when it changes.

Some comments have been hidden by the post's author - find out more