Implementing an offline chat using MQTT

Viewed 209

I am creating a group chat app and was wondering how I can save the messages received while one of the users was offline. Ex. User A, User B, User C are in a group chat, User B goes offline (loses connection), how do I have it so that when he joins back he recieves the messages between User A and User C while he was gone?. Is this even possible with MQTT or do I have to save the messages in a database?

1 Answers

I figured it out if anyone is interested. I set my cleanSession to false so it wouldn't create a new session on reconnection, also make sure to keep the client's id is the same because that is what it is saved under in the queue.

Related