WebSocket : EventTarget
WebSockets are a persistent connection to a server that allows sending and receiving data.
Spec:
https://html.spec.whatwg.org/multipage/web-sockets.html#the-websocket-interface
----
new WebSocket(url : String) : WebSocket
Constructs a new WebSocket connection to **url**.
----
new WebSocket(url : String, protocol : String) : WebSocket
Same as %%#new_WebSocket_String_Iterable|**new WebSocket(url, [protocol])**%%.
----
new WebSocket(url : String, protocols : Iterable) : WebSocket
----
instance.url : String
The url passed to the WebSocket constructor.
ReadOnly:
true
----
instance.readyState : Number
One of %%#CONNECTING|**WebSocket.CONNECTING**%%,
%%#OPEN|**WebSocket.OPEN**%%,
%%#CLOSING|**WebSocket.CLOSING**%%, or
%%#CLOSED|**WebSocket.CLOSED**%%.
ReadOnly:
true
----
instance.bufferedAmount : Number
ReadOnly:
true
----
instance.extensions : String
ReadOnly:
true
----
instance.protocol : String
ReadOnly:
true
----
instance.binaryType : String
Set to either **'arraybuffer'** or **'blob'** to choose if the %%MessageEvent#data|MessageEvent.data%%
property will be an %%/ArrayBuffer|ArrayBuffer%% or a %%/Blob|Blob%% for binary
data received by the WebSocket.
----
prototype.close([code : Number, [reason : String]]) : undefined
Closes the WebSocket connection.
----
prototype.send(data : ArrayBuffer) : undefined
Sends **data** to the server.
----
prototype.send(data : ArrayBufferView) : undefined
Sends **data** to the server.
----
prototype.send(data : Blob) : undefined
Sends **data** to the server.
----
prototype.send(data : String) : undefined
Sends **data** to the server.
----
CONNECTING : Number
The value of %%#readyState|readyState%% after constructing the WebSocket and before
%%#onopen|onopen%% fires.
ReadOnly:
true
Value:
0
----
OPEN : Number
The value of %%#readyState|readyState%% after %%#onopen|onopen%% fires.
ReadOnly:
true
Value:
1
----
CLOSING : Number
The value of %%#readyState|readyState%% after calling %%#close|**close()**%% and before
%%#onclose|onclose%% fires.
ReadOnly:
true
Value:
2
----
CLOSED : Number
The value of %%#readyState|readyState%% after %%#onclose|onclose%% fires.
ReadOnly:
true
Value:
3
----
event.open : listener(event : Event) : undefined
----
event.error : listener(event : ErrorEvent) : undefined
----
event.close : listener(event : CloseEvent) : undefined
----
event.message : listener(event : MessageEvent) : undefined