This is the person who creates the chat application in NodeJS (SocketIO).
We use the following methods to send to specific users:
io.to(socket.id).json.emit('message',message);
How do I close a socket for a particular user using the socket ID?
javascript node.js websocket
io.sockets.connected [socket.id].disconnect();
Namespace#connected
seems to be used to reference Socket from Socket#id.
Therefore, if you do not use Namespace, use the alias Server#sockets
to the default Namespace /
as shown above.
Official server-side API documentation
© 2024 OneMinuteCode. All rights reserved.