Skip to content

Instantly share code, notes, and snippets.

View tranvanthuc's full-sized avatar

Tran Van Thuc tranvanthuc

View GitHub Profile
@tranvanthuc
tranvanthuc / socket-cheatsheet.js
Created December 23, 2019 15:51 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// 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