Created
October 30, 2012 14:01
-
-
Save Rcomian/3980332 to your computer and use it in GitHub Desktop.
Basic socket.io infrastructure
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
// Server | |
var socketio = require('socket.io'); | |
var server = http.createServer(app); | |
var io = socketio.listen(server); | |
io.sockets.on('connection', function(socket) { | |
... | |
}); | |
// Client | |
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js') | |
script(src='/socket.io/socket.io.js') | |
script(src='/javascripts/whiteboard.js') | |
var socket = io.connect(window.location.protocol + '//' + window.location.hostname + ':' + window.location.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment