Reputation: 163
I am creating a chat application with Node.js's Socket.IO and there are a couple of things I need clarification on.
I am implementing offline messaging in my app meaning that when a user opens the app he will receive all the messages he missed when they were online.
This is my approach:
Is this a correct approach?
I was looking online and some people suggested using task/message queues like Google App Engines Task Queue, but I am not sure how this works.
Upvotes: 1
Views: 223
Reputation: 4190
Your approach sounds OK, but I wouldn't delete messages from a DB, at least not immediately after the client receives them.
From your question it seems that you're not currently saving the messages to a database. This approach has some drawbacks; for example, the user can't view their chat history on a device that was not connected when some of the messages were sent.
There are 2 ways I can think of to do it in a more elegant manner:
HTTP
or WebSockets
.The first approach is much better for the general use case in my opinion, but it depends on your use case.
Upvotes: 1