The URL to which to connect; this should be the URL to which the WebSocket server will respond.
Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). If you don't specify a protocol string, an empty string is assumed.
A string indicating the type of binary data being transmitted by the connection.
A string indicating the type of binary data being transmitted by the connection. This should be either "blob" if DOM Blob objects are being used or "arraybuffer" if ArrayBuffer objects are being used.
The number of bytes of data that have been queued using calls to send() but not yet transmitted to the network.
The number of bytes of data that have been queued using calls to send() but not yet transmitted to the network. This value resets to zero once all queued data has been sent. This value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. Read only.
Closes the WebSocket connection or connection attempt, if any.
Closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
Optional: A numeric value indicating the status code explaining why the connection is being closed. If this parameter is not specified, a default value of 1000 (indicating a normal "transaction complete" closure) is assumed. See the list of status codes on the CloseEvent page for permitted values.
Optional: A human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not characters).
The extensions selected by the server.
The extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection.
An event listener to be called when the WebSocket connection's readyState changes to CLOSED.
An event listener to be called when the WebSocket connection's readyState changes to CLOSED. The listener receives a CloseEvent named "close".
An event listener to be called when an error occurs.
An event listener to be called when an error occurs. This is a simple event named "error".
An event listener to be called when a message is received from the server.
An event listener to be called when a message is received from the server. The listener receives a MessageEvent named "message".
An event listener to be called when the WebSocket connection's readyState changes to OPEN; this indicates that the connection is ready to send and receive data.
An event listener to be called when the WebSocket connection's readyState changes to OPEN; this indicates that the connection is ready to send and receive data. The event is a simple one with the name "open".
A string indicating the name of the sub-protocol the server selected; this will be one of the strings specified in the protocols parameter when creating the WebSocket object.
The current state of the connection; this is one of the Ready state constants.
The current state of the connection; this is one of the Ready state constants. Read only.
Transmits data to the server over the WebSocket connection.
Transmits data to the server over the WebSocket connection.
A text string to send to the server.
The URL as resolved by the constructor.
The URL as resolved by the constructor. This is always an absolute URL. Read only.
The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API