2022-02-15 22:40:51 +03:30
|
|
|
#import <DOM/EventTarget.idl>
|
2022-03-30 23:35:42 +03:00
|
|
|
#import <DOM/EventHandler.idl>
|
2023-11-08 11:04:56 -07:00
|
|
|
#import <FileAPI/Blob.idl>
|
2022-02-15 22:40:51 +03:30
|
|
|
|
2022-10-07 16:45:09 -06:00
|
|
|
// https://websockets.spec.whatwg.org/#websocket
|
2023-09-03 02:00:01 +12:00
|
|
|
[Exposed=(Window,Worker)]
|
2021-04-24 13:54:24 +02:00
|
|
|
interface WebSocket : EventTarget {
|
|
|
|
|
|
2022-12-31 10:37:10 +00:00
|
|
|
constructor(USVString url, optional (DOMString or sequence<DOMString>) protocols);
|
2021-04-24 13:54:24 +02:00
|
|
|
|
|
|
|
|
readonly attribute USVString url;
|
|
|
|
|
|
2023-10-25 17:27:19 +02:00
|
|
|
// ready state
|
2021-04-24 13:54:24 +02:00
|
|
|
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;
|
2024-05-19 22:15:54 +12:00
|
|
|
[FIXME] readonly attribute unsigned long long bufferedAmount;
|
2021-04-24 13:54:24 +02:00
|
|
|
|
2023-10-25 17:27:19 +02:00
|
|
|
// networking
|
2021-04-24 13:54:24 +02:00
|
|
|
attribute EventHandler onopen;
|
|
|
|
|
attribute EventHandler onerror;
|
|
|
|
|
attribute EventHandler onclose;
|
|
|
|
|
readonly attribute DOMString extensions;
|
|
|
|
|
readonly attribute DOMString protocol;
|
2024-08-24 12:14:22 +01:00
|
|
|
undefined close(optional [Clamp] unsigned short code, optional USVString reason);
|
2021-04-24 13:54:24 +02:00
|
|
|
|
2023-10-25 17:27:19 +02:00
|
|
|
// messaging
|
2021-04-24 13:54:24 +02:00
|
|
|
attribute EventHandler onmessage;
|
|
|
|
|
attribute DOMString binaryType;
|
2023-04-20 19:15:21 +01:00
|
|
|
undefined send((BufferSource or Blob or USVString) data);
|
2021-04-24 13:54:24 +02:00
|
|
|
};
|