socket io tutorial - Simple Way to Emit Messages By User Id - socket io android - socket io client
Simple Way To Emit Messages By User Id
On the server:
- Here the socket uses
connect
to check the connection and calljoin
to subscribe the given channel - Every sockets contain an uniqueid if we want to send message to an unique id then call the
userId
- And then
emit
the message for any other process within the channel - And finally
leave
from the channel
Read Also
Hello world with socket messageOn the client:
- The client emit the message to any channel randomly
Both method allows sending messages to specific users by unique id without holding a reference to all sockets on the server.