Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created December 30, 2018 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amandeepmittal/bff64cf186bbd565d5ac7a0de3319d42 to your computer and use it in GitHub Desktop.
Save amandeepmittal/bff64cf186bbd565d5ac7a0de3319d42 to your computer and use it in GitHub Desktop.
io.on('connection', socket => {
socket.emit('request' /* … */); // emit an event to the socket
io.emit('broadcast' /* … */); // emit an event to all connected sockets
socket.on('reply', () => {
/* … */
}); // listen to the event
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment