Last active
February 15, 2019 19:30
-
-
Save brikis98/7624718 to your computer and use it in GitHub Desktop.
Echo server in socket.io
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
var io = require('socket.io').listen(80); | |
io.sockets.on('connection', function (socket) { | |
console.log("Someone just connected!"); | |
// Echo back messages from the client | |
socket.on('message', function (message) { | |
console.log("Got message: " + message); | |
socket.emit('message', message); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment