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