1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibWeb: Add WebSocket bindings

The WebSocket bindings match the original specification from the
WHATWG living standard, but do not match the later update of the
standard that involves FETCH. The FETCH update will be handled later
since the changes would also affect XMLHttpRequest.
This commit is contained in:
DexesTTP 2021-04-24 13:54:24 +02:00 committed by Linus Groh
parent 68bfb46a6f
commit 22413ef729
16 changed files with 593 additions and 1 deletions

View file

@ -0,0 +1,29 @@
interface WebSocket : EventTarget {
// FIXME: A second "protocols" argument should be added once supported
constructor(USVString url);
readonly attribute USVString url;
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 long bufferedAmount;
attribute EventHandler onopen;
attribute EventHandler onerror;
attribute EventHandler onclose;
readonly attribute DOMString extensions;
readonly attribute DOMString protocol;
undefined close(optional unsigned short code, optional USVString reason);
attribute EventHandler onmessage;
attribute DOMString binaryType;
undefined send(USVString data);
// FIXME: Support other kinds of send() calls
// undefined send(Blob data);
// undefined send(ArrayBuffer data);
// undefined send(ArrayBufferView data);
};