nishiths23 / flutter-firebase-chat

MIT License
1 stars 0 forks source link

Message status: "Unread" , "Seen" so we can display a red dot, or alert if the user has unread messages in a room #2

Open giorgio79 opened 3 years ago

giorgio79 commented 3 years ago

Would be nice if this lib could track seen and unread messages. If there are unread messages, the chat button could have a red dot to show there are new messages etc.

giorgio79 commented 3 years ago

I found a nice algo here https://stackoverflow.com/questions/22623879/managing-unread-messages-in-firebase-chat "I'd recommend just keeping a timestamp of the last time the user has visited the room, and query for messages that have been received since then. This should scale well into the thousands. If your chat rooms have millions of messages (hint: they don't) you could get a bit more mileage by using the gmail approach and only grabbing up to 1k messages and saying something along the lines of "1000 or more unread messages"

And the official Firechat is interesting too https://stackoverflow.com/questions/38935609/chat-message-with-google-firebase-realtime-database-architecture-with-unread-mes