Skip to content

Instantly share code, notes, and snippets.

@j4rs
Created June 13, 2012 18:19
Show Gist options
  • Save j4rs/2925625 to your computer and use it in GitHub Desktop.
Save j4rs/2925625 to your computer and use it in GitHub Desktop.
Native Web Socket Client
var ws = new WebSocket("ws://server:9876");
ws.onopen = function() { ... };
ws.onerror = function() { ... };
ws.onclose = function() { ... };
ws.onmessage = function(event) { event.data };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment