Created
May 10, 2016 11:43
-
-
Save nasitra/30cde8b259d794c82dc45058d8ead151 to your computer and use it in GitHub Desktop.
Broadcast server implemented with Node.js
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
var WebSocketServer = require('ws').Server; | |
var wss = new WebSocketServer({ port: 8080 }); | |
wss.on('connection', function(ws) { | |
ws.on('message', function(message) { | |
wss.clients.forEach(function(client) { | |
client.send(message); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment