WebSocketsAPI
Types
binaryType
closeEvent
A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. See CloseEvent on MDN
Record fields
type_
Returns the type of event, e.g. "click", "hashchange", or "submit". Read more on MDN
target
Returns the object to which event is dispatched (its target). Read more on MDN
currentTarget
Returns the object whose event listener's callback is currently being invoked. Read more on MDN
eventPhase
Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. Read more on MDN
bubbles
Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. Read more on MDN
cancelable
Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. Read more on MDN
defaultPrevented
Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. Read more on MDN
composed
Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. Read more on MDN
isTrusted
Returns true if event was dispatched by the user agent, and false otherwise. Read more on MDN
timeStamp
Returns the event's timestamp as the number of milliseconds measured relative to the time origin. Read more on MDN
reason
Returns the WebSocket connection close reason provided by the server. Read more on MDN
Module
There are methods and helpers defined in CloseEvent .
closeEventInit
Record fields
bubbles
cancelable
composed
wasClean
code
reason
messageEvent
A message received by a target object. See MessageEvent on MDN
Record fields
type_
Returns the type of event, e.g. "click", "hashchange", or "submit". Read more on MDN
target
Returns the object to which event is dispatched (its target). Read more on MDN
currentTarget
Returns the object whose event listener's callback is currently being invoked. Read more on MDN
eventPhase
Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. Read more on MDN
bubbles
Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. Read more on MDN
cancelable
Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. Read more on MDN
defaultPrevented
Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. Read more on MDN
composed
Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. Read more on MDN
isTrusted
Returns true if event was dispatched by the user agent, and false otherwise. Read more on MDN
timeStamp
Returns the event's timestamp as the number of milliseconds measured relative to the time origin. Read more on MDN
origin
Returns the origin of the message, for server-sent events and cross-document messaging. Read more on MDN
source
Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects. Read more on MDN
ports
Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging. Read more on MDN
Module
There are methods and helpers defined in MessageEvent .
messageEventInit
Record fields
bubbles
cancelable
composed
data
origin
lastEventId
source
ports
messageEventSource
webSocket
Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. See WebSocket on MDN
Record fields
readyState
Returns the state of the WebSocket object's connection. It can have the values described below. Read more on MDN
bufferedAmount
Returns the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but not yet been transmitted to the network.
If the WebSocket connection is closed, this attribute's value will only increase with each call to the send() method. (The number does not reset to zero once the connection closes.) Read more on MDN
protocol
Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. Read more on MDN
binaryType
Returns a string that indicates how binary data from the WebSocket object is exposed to scripts:
Can be set, to change how binary data is returned. The default is "blob". Read more on MDN
Module
There are methods and helpers defined in WebSocket .