Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Motaz Hejaze motaz-hejaze

🏠
Working from home
View GitHub Profile
@motaz-hejaze
motaz-hejaze / socket-cheatsheet.js
Created Jan 11, 2020 — forked from alexpchin/socket-cheatsheet.js
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