From f1b39a6b1d0f30c4dce63a6b2a2aa9d839483285 Mon Sep 17 00:00:00 2001 From: Faraz Patankar Date: Mon, 3 Apr 2017 10:50:38 +0530 Subject: [PATCH] [docs] Update emit cheatsheet (#2906) --- docs/emit.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/emit.md b/docs/emit.md index 344d1b38..c0226184 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').to('room').emit('event', 'message'); + // sending to individual socketid (private message) socket.to().emit('hey', 'I just met you');