mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-09 15:08:12 -05:00
[docs] Update emit cheatsheet (#2906)
This commit is contained in:
committed by
Damien Arrachequesne
parent
240b154960
commit
f1b39a6b1d
@@ -25,6 +25,9 @@ function onConnect(socket){
|
||||
// sending to all clients in namespace 'myNamespace', including sender
|
||||
io.of('myNamespace').emit('bigger-announcement', 'the tournament will start soon');
|
||||
|
||||
// sending to a specific room in a specific namespace, including sender
|
||||
io.of('myNamespace').to('room').emit('event', 'message');
|
||||
|
||||
// sending to individual socketid (private message)
|
||||
socket.to(<socketid>).emit('hey', 'I just met you');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user