I create a real-time chat, very similar to skype one. I use firebase as a backend and angularfire on the client side. Basically, all things look clear, but I'm stuck on one thing: showing unread messages.
The application uses a very simple Firebase design: 2 or more users can communicate in the "room" - the root collection with a unique name. A chat message, in addition to text, may contain "metadata" - the sender ID, timestamp, etc.
I just need to emulate this pseudocode:
room.messages.where ({unread: true}). count ()
So far, according to this , (can I count the children in the place without getting the actual child data?) And this I am trying to control the number of unread messages in each room by transactions and reset count when viewing. But this is a very difficult part, and I'm curious if we have any recommended approach that can reduce the amount of work?
source
share