Identify offline chat users, get delivery receipts and message history

Hi, I’m using Phoenix Channels for developing an instant messaging social networking mobile app. Requirement is to have a WhatsApp like group chat feature. Idea was to use phoenix presence to identify the online users for instant message broadcast and to send push notification to offline users. However, while going through presence docs. it seems we get to know only the online (connected) users and the events of user leaving.

  1. What’s the ideal design to get list of all offline users for a topic (group in this case)? Should i use a db query to get the delta of users and then fire a push notification? Doing that for every message, on every topic, felt a bit expensive in terms of performance. Am i missing any built in mechanism in phoenix channels/presence for handling this use case?
  2. Or, for handling a persistent chat for mobile app with offline push, delivery receipts, message history load for when user comes online - should i be using an XMPP alternative like Ejabberd or MongooseIM ?
2 Likes

Can I ask: do you have a public code repository for this and do you intend to make it so it’s easy to integrate into other apps that are created with Phoenix. I’d be very interested in your project if so.

1 Like

Hello Peter, I really appreciate you asking me. Unfortunately code is not available in public repo and I’m afraid I’ll not be able to do so with this project, as per the company policy. Thank you.

2 Likes

You could keep a user list in ETS/Mnesia for each topic and move users from offline to online (and back). If you only do it for active / recent topics it shouldn’t be too bad and you’ll maintain both lists at all times.

2 Likes

Can I ask how you solve the problem?