Skip to content

Instantly share code, notes, and snippets.

@giavac
Last active August 29, 2015 14:13
Show Gist options
  • Save giavac/2d92c71937aba927c0a7 to your computer and use it in GitHub Desktop.
Save giavac/2d92c71937aba927c0a7 to your computer and use it in GitHub Desktop.
A simple WebSocket server with node.js ws module
// Source: https://github.com/einaros/ws
var WebSocketServer = require('ws').Server
, wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
});
ws.send('something');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment