Skip to content

Instantly share code, notes, and snippets.

@phuesler
Created November 7, 2011 23:04
Show Gist options
  • Save phuesler/1346486 to your computer and use it in GitHub Desktop.
Save phuesler/1346486 to your computer and use it in GitHub Desktop.
var socket;
var host = "ws://localhost:8080";
var socket = new WebSocket(host);
socket.onopen = function(){
console.log('open');
}
socket.onmessage = function(msg){
console.log(msg.data);
}
socket.onclose = function(){
console.log('closed');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment