Last active
April 27, 2016 20:44
-
-
Save ramonvictor/4696208b06f954782e9111043cefbe90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [require modules and do some express setup] | |
// ...and here is where the magic happens: | |
io.on('connection', function(socket) { | |
socket.on('room', function(room) { | |
socket.join(room); | |
}); | |
socket.on('dispatch', function(data) { | |
socket.broadcast.to(data.room).emit('dispatch', data); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment