R
R
Rinat2018-05-08 02:16:11
JavaScript
Rinat, 2018-05-08 02:16:11

Socket.io, is it possible to wait for messages?

Greetings, knowledgeable people tell me who knows where to drip

The situation is this, there is node.js with socket.io there is a website and there is an android application.
communication WEB and Android. android has a service to check for new chat messages, but it doesn't work right away. The question is how to implement it so that when a message was written on the WEB client and it was waiting for the interlocutor to connect, respectively, when the interlocutor connected, he received those messages that did not reach him in his absence.

Are there any standard tools or do you need to reinvent the wheel?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2018-05-08
@BorisKorobkov

Node.js receives and saves messages. When the desired interlocutor connects, "his" messages are sent to him.

A
Abcdefgk, 2018-05-08
@Abcdefgk

There is nothing special to invent - save messages to the database, and that's it. When a socket is connected to a room, we send it the last three (say) messages from the array of messages for this room.
I already tried it out of curiosity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question