#The best way to implement chat feature in mobile apps

6 messages · Page 1 of 1 (latest)

glacial hawk
#

I am implementing a chat feature and now I got it working with socket io on nestjs and react native. Now I want that when the app is in background to get push notifications, and when in app get in-app notification.

Now what is the best way to do this:

should I store whether the app is in background with redis through websockets connects and disconnects and use that logic in the server.

Or should I just use websockets and kinda "simulate" push notifications on the frontend (don't know if possible)

Or should I only use push notifications for every message and handle them when the app is active

Or you tell me

Any help or suggestion would be helpful. Thanks

#

[Architecture] The best way to implement chat feature in mobile apps

mystic forge
#

Without going into detail, I would only send push when I see the client is not active (or is disconnected)

worldly trellis
#

I went all in on push messages through firebase cloud messaging, even for when the user is using the app.
This works fine and reliably, without any major outage, free, for around 5 years, and served thousands of users.

This could be a place to optimize later, when processing millions of messages, but I wouldn't worry about it until then.
Keeping connections open on mobiles is tricky, and detection of user/app activity is going to be difficult to get right.

glacial hawk
#

That sounds good also, i was worried about only using push messages but i will give it a try

#

Thanks guys