summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebSockets/WebSocket.idl
blob: ebd4545e6dbfd188c59eb452a5dc842536694f0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import <DOM/EventTarget.idl>
#import <DOM/EventHandler.idl>

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);
};