What about when i send message and other device is offline.
You don't add this functionality.
Node.js is not reliable solution for chat applications. There is better options out there. Like XMPP server which is most trusted and reliable solutions.
i didn't say that node js can do everything but at least the socket.io implementation is very simple and there are a lot of features that you can add.
i'v tried to establish a socket server once in java and it was like hell but with node js i'v totally love doing it coz it was just less than 20 line of code and everything works like a charm
You can store messages in a database like redis and mark them unread and then serve them when the user logs back in. This is the approach I am using right now, let me know if something is wrong with this approach.
How will the socket.on listener work if the chat activity is not open ? I want the listener to run in the background all the time so whenever the new message is sent , it updates the Ui even if i am not using the app
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What about when i send message and other device is offline.
You don't add this functionality.
Node.js is not reliable solution for chat applications. There is better options out there. Like XMPP server which is most trusted and reliable solutions.
i didn't say that node js can do everything but at least the socket.io implementation is very simple and there are a lot of features that you can add.
i'v tried to establish a socket server once in java and it was like hell but with node js i'v totally love doing it coz it was just less than 20 line of code and everything works like a charm
XMPP servers like OPENFIRE also totally built in java and provides much more functionality than node.js sockets.
You can store messages in a database like redis and mark them unread and then serve them when the user logs back in. This is the approach I am using right now, let me know if something is wrong with this approach.
hey brother can you please help to make me understadable how do you work this such thing
im a student of 2nd year and i want to gain knowledeg
How will the socket.on listener work if the chat activity is not open ? I want the listener to run in the background all the time so whenever the new message is sent , it updates the Ui even if i am not using the app