This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sending to the client | |
socket.emit('hello', 'can you hear me?', 1, 2, 'abc'); | |
// sending to all clients except sender | |
socket.broadcast.emit('broadcast', 'hello friends!'); | |
// sending to all clients in 'game' room except sender | |
socket.to('game').emit('nice game', "let's play a game"); | |
// sending to all clients in 'game1' and/or in 'game2' room, except sender |