Client-side API
The WebSocket object attribute websocketobjext.readystate shows the different stages of connection establishment; the possible values and meanings are: 1) The connection is not yet established; 2) The connection is established and communication is possible; 3) The connection is at the stage of closing the handshake; and 4) The connection is closed. The websocketobject.bufferedamount attribute shows the number of bytes queued to send.
WebSocket events include onopen(), triggered when a connection is opened; onclose(), when it is closed; onerror(), when any error occurs; and onmessage(), when a new message is received from the server.
WebSocket methods include send() to send a message to