WebSocket.idl 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #import <DOM/EventTarget.idl>
  2. #import <DOM/EventHandler.idl>
  3. // https://websockets.spec.whatwg.org/#websocket
  4. [Exposed=(Window,Worker)]
  5. interface WebSocket : EventTarget {
  6. constructor(USVString url, optional (DOMString or sequence<DOMString>) protocols);
  7. readonly attribute USVString url;
  8. const unsigned short CONNECTING = 0;
  9. const unsigned short OPEN = 1;
  10. const unsigned short CLOSING = 2;
  11. const unsigned short CLOSED = 3;
  12. readonly attribute unsigned short readyState;
  13. // readonly attribute unsigned long long bufferedAmount;
  14. attribute EventHandler onopen;
  15. attribute EventHandler onerror;
  16. attribute EventHandler onclose;
  17. readonly attribute DOMString extensions;
  18. readonly attribute DOMString protocol;
  19. undefined close(optional unsigned short code, optional USVString reason);
  20. attribute EventHandler onmessage;
  21. attribute DOMString binaryType;
  22. undefined send(USVString data);
  23. // FIXME: Support other kinds of send() calls
  24. // undefined send(Blob data);
  25. // undefined send(ArrayBuffer data);
  26. // undefined send(ArrayBufferView data);
  27. };