Skip to content

Instantly share code, notes, and snippets.

@patwey
Last active March 1, 2016 18:18
Show Gist options
  • Save patwey/8ab820a64f0a3bdc2d86 to your computer and use it in GitHub Desktop.
Save patwey/8ab820a64f0a3bdc2d86 to your computer and use it in GitHub Desktop.

Socket.io .send vs .emit

.send

Sender:

socket.send('my channel name', { my message data })

Reciever:

socket.on('message', function(channel, message) { 
  // do things 
})

.emit

Sender:

socket.emit('type', { my message data})

Reciever:

socket.on('type', function(message) { 
  // do things
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment