From 1e685b4ff171b9c8ed9a66a960a653a0cca1f5c5 Mon Sep 17 00:00:00 2001 From: Faraz Patankar Date: Fri, 31 Mar 2017 13:27:50 +0530 Subject: [PATCH 1/2] [docs] Update emit cheatsheet --- docs/emit.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/emit.md b/docs/emit.md index 344d1b380f..8b9c51e0ea 100644 --- a/docs/emit.md +++ b/docs/emit.md @@ -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').in('room').emit('event', 'message'); + // sending to individual socketid (private message) socket.to().emit('hey', 'I just met you'); From 7d014d9b82f98a147e15ae0ac2c59397ea861070 Mon Sep 17 00:00:00 2001 From: Faraz Patankar Date: Fri, 31 Mar 2017 19:34:52 +0530 Subject: [PATCH 2/2] Update emit.md Add example of how to emit to a room within a namespace. --- docs/emit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/emit.md b/docs/emit.md index 8b9c51e0ea..c022618423 100644 --- a/docs/emit.md +++ b/docs/emit.md @@ -26,7 +26,7 @@ function onConnect(socket){ 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').in('room').emit('event', 'message'); + io.of('myNamespace').to('room').emit('event', 'message'); // sending to individual socketid (private message) socket.to().emit('hey', 'I just met you');