Skip to content

Instantly share code, notes, and snippets.

@protestContest
Created November 3, 2012 21:07
Show Gist options
  • Save protestContest/4008814 to your computer and use it in GitHub Desktop.
Save protestContest/4008814 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
console.log('connecting...');
connect();
});
function connect() {
console.log('connecting to ' + window.location.host);
var socket = new io.connect('http://' + window.location.host);
// partner is connected
socket.on('ready', function() {
console.log('connection made');
});
// receive message
socket.on('message', function(msg) {
console.log('message: ' + msg);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment