Created
May 17, 2013 17:41
-
-
Save JangoSteve/5600689 to your computer and use it in GitHub Desktop.
Websocket Presentation Abstract
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
// Steve (server) | |
var WebSocketServer = require('ws').Server | |
, wss = new WebSocketServer({port: 8080}); | |
wss.on('connection', function(ws) { | |
ws.on('message', function(message) { | |
ws.send("Sure thing, how's this?"); | |
}); | |
}); | |
// Brian (browser) | |
var connection = new WebSocket('ws://steve.alfajango.com', ['soap', 'xmpp']); | |
connection.onopen = function () { | |
connection.send("Can we please get an abstract for this presentation?"); | |
}; | |
connection.onmessage = function(message) { | |
if (message) { | |
connection.send("Awesome, thanks!"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment