Skip to content

Instantly share code, notes, and snippets.

@kruyvanna
Created July 25, 2013 03:44
Show Gist options
  • Save kruyvanna/6076763 to your computer and use it in GitHub Desktop.
Save kruyvanna/6076763 to your computer and use it in GitHub Desktop.
var host = window.location.hostname;
var port = 3001;
var serverAddress = host + ":" + port;
console.log('serverAddress:' + serverAddress);
var websocket = new WebSocket("ws:" + serverAddress);
websocket.onmessage = function(message){
console.log('onmessage: ', message);
if(message.data === "jump"){
stage.click();
}
};
websocket.onerror = function(message){
console.log('onerror: ' + message);
}
websocket.onopen = function(message){
console.log('onopen', message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment