WebSocket.idl 1.0 KB

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