WebSocket
new WebSocket(url, protocols)
stringstring | Array.<string>webSocket.protocol
Returns: string - returns 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.
webSocket.bufferedAmount
Returns: number - returns 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
webSocket.binaryType
stringwebSocket.binaryType
Returns: string - returns the string indicating the binary data type.
webSocket.send(data)
Enqueues the specified data to be transmitted to the other end over the WebSocket connection, increasing the value of bufferedAmount by the number of bytes needed to contain the data. If the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically.
string | ArrayBuffer | ArrayBufferViewwebSocket.close([code], [reason])
Closes the websocket connection
integer1000string""