Skip to content

Instantly share code, notes, and snippets.

@stevelacey
Created March 26, 2011 21:47
Show Gist options
  • Save stevelacey/888668 to your computer and use it in GitHub Desktop.
Save stevelacey/888668 to your computer and use it in GitHub Desktop.
[Constructor(in DOMString url, in optional DOMString protocols)]
[Constructor(in DOMString url, in optional DOMString[] protocols)]
interface WebSocket {
readonly attribute DOMString url;
// ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSING = 2;
const unsigned short CLOSED = 3;
readonly attribute unsigned short readyState;
readonly attribute unsigned long bufferedAmount;
// networking
attribute Function onopen;
attribute Function onmessage;
attribute Function onerror;
attribute Function onclose;
readonly attribute DOMString protocol;
void send(in DOMString data);
void close();
};
WebSocket implements EventTarget;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment