readyState property
Returns the state of the WebSocket connection.
This property is read-only.
Syntax
| JavaScript |
|---|
iReadyState = object.readyState |
Property values
Type: Number
One of the following numerical values:
- CONNECTING (0) Default
- OPEN (1)
- CLOSING (2)
- CLOSED (3)
Remarks
When the WebSocket is first created, the readyState is set to CONNECTING. When the connection is established, the readyState is set to OPEN. If the connection fails, then the readyState is set to CLOSED.
See also
Show: