DEV Community

Discussion on: Playtomic's chat solution with Firebase Realtime DB

Collapse
angelolloqui profile image
Angel G. Olloqui Author • Edited on

Hi @codi0 ! I'm glad you found it useful. Regarding your questions:

  • We still have the same design in place. We have done some minor improvements on the chat but nothing that affects the design decisions exposed in here. So far, the chat has grown a lot (a 10x since the post, with more than 1K messages a day), and we are now fully consuming the free tier and starting to pay. We are still not paying much but if we continue this trend we will have to make some design changes in a not so far future (not sure how yet).

  • I am not sure I understand your second question fully, but what we do to handle the multiple threads is:

    1. We have a global unread chat message count in the user entry that we keep listening for the whole app session. This has very little data and changes only on new messages received on the user's thread. It is used to set the chat badge on the tabbar and some other places
    2. We have a screen with the user's chat thread list, sorted by last message and paginated to most recent ones. User's can request more by scrolling down but by default only 20 get downloaded. This list is only observed when the user is inside the chat list screen, and the observer released when he leaves. The list does not contain the messages, only the thread info (which contains a copy of the last one)
    3. When user gets into a specific thread, then we start observing messages of that thread. We release the observer as soon as he leaves the screen.
    4. Users also get a push notification when a new message is added to any thread (except if he is already viewing the thread detail screen)
Collapse
codi0 profile image
codi0

Good to hear it's growing nicely. Hope that continues! And thanks for answering my slightly unclear question with so much detail, very helpful. :)