Answer the question
In order to leave comments, you need to log in
How to send message to specific user from Node.js socket server?
I'm using websockets to create a server socket in Node.js
I've read the documentation but one question remains:
How to send a message to a specific connected user? Now all samples are about the general message.
As far as I know I need to create a channel with a unique name for each user on the server and then on the client link them to receive messages?
Answer the question
In order to leave comments, you need to log in
And how do you manage to send a websocket message NOT to a specific user? The protocol is designed as a point-to-point exchange. You only need to learn how to distinguish between these users.
To do this, when establishing a connection, you need to receive some data for authorization (for example, a token or session ID), and keep a connection pool in which, if necessary, you can find the connection of the desired user.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question