Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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

WebSocket
close
onclose
onopen
WebSockets in Windows
WebSockets RFC 6455
The WebSocket API

 

 

Show:
© 2015 Microsoft