Skip to content

Instantly share code, notes, and snippets.

@shrekuu
Created June 28, 2018 10:54
Show Gist options
  • Select an option

  • Save shrekuu/936efed73619bba3ff541a3606699f9c to your computer and use it in GitHub Desktop.

Select an option

Save shrekuu/936efed73619bba3ff541a3606699f9c to your computer and use it in GitHub Desktop.
socket.io server side example
const server = require('http').createServer();
const io = require('socket.io')(server, {
path: '/remote-control-sockjs',
});
const port = process.env.PORT || 8080;
server.listen(port);
io.on('connection', function (socket) {
socket.on('slide-change', function (detail) {
console.log(detail);
io.emit('slide-change', detail);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment