Instantly share code, notes, and snippets.

Pierpaolo PierpaoloLucarelli

View GitHub Profile
@alexpchin
alexpchin / socket-cheatsheet.js
Created Dec 15, 2015
A quick cheatsheet for socket.io
View socket-cheatsheet.js
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender