Created
June 28, 2018 10:54
-
-
Save shrekuu/936efed73619bba3ff541a3606699f9c to your computer and use it in GitHub Desktop.
socket.io server side example
This file contains hidden or 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
| 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