[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:
Damien Arrachequesne
2018-04-27 12:50:31 +02:00
committed by GitHub
parent db831a3de4
commit 2917942b3e

View File

@@ -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) {});