Skip to content

Instantly share code, notes, and snippets.

@wildfalcon
Created June 8, 2011 16:52
Show Gist options
  • Save wildfalcon/1014811 to your computer and use it in GitHub Desktop.
Save wildfalcon/1014811 to your computer and use it in GitHub Desktop.
Web Socket API
// to open a websocket
socket = new WebSocket("ws://<server>:<port>/<path>");
// to react to a message
socket.onmessage = function(event) {
// your code
}
// to send a message
socket.send("a string")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment