Skip to content

Instantly share code, notes, and snippets.

@ctrldavid
Last active December 15, 2015 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctrldavid/5297665 to your computer and use it in GitHub Desktop.
Save ctrldavid/5297665 to your computer and use it in GitHub Desktop.
ws = new WebSocket('ws://localhost:5000/');
ws.onmessage = function(obj){
console.log("got", obj["data"]);
};
ws.send("blar");
var server, ws;
ws = require('ws');
server = new ws.Server({
port: 5000
});
server.on('connection', function(connection) {
return connection.on('message', function(msg) {
return connection.send(msg);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment