mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-10 07:28:06 -05:00
[docs] Clarify private messaging in the emit cheatsheet (#3232)
The previous version was confusing, as `socket.to(socket.id).emit()` does nothing. Fixes #3220
This commit is contained in:
committed by
GitHub
parent
db831a3de4
commit
2917942b3e
@@ -29,7 +29,7 @@ function onConnect(socket){
|
||||
io.of('myNamespace').to('room').emit('event', 'message');
|
||||
|
||||
// sending to individual socketid (private message)
|
||||
socket.to(<socketid>).emit('hey', 'I just met you');
|
||||
io.to(<socketid>).emit('hey', 'I just met you');
|
||||
|
||||
// sending with acknowledgement
|
||||
socket.emit('question', 'do you think so?', function (answer) {});
|
||||
|
||||
Reference in New Issue
Block a user