Skip to content

Commit 2917942

Browse files
[docs] Clarify private messaging in the emit cheatsheet (#3232)
The previous version was confusing, as `socket.to(socket.id).emit()` does nothing. Fixes #3220
1 parent db831a3 commit 2917942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/emit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function onConnect(socket){
2929
io.of('myNamespace').to('room').emit('event', 'message');
3030

3131
// sending to individual socketid (private message)
32-
socket.to(<socketid>).emit('hey', 'I just met you');
32+
io.to(<socketid>).emit('hey', 'I just met you');
3333

3434
// sending with acknowledgement
3535
socket.emit('question', 'do you think so?', function (answer) {});

0 commit comments

Comments
 (0)