The WebSocket.readyState
read-only property returns the current state of the WebSocket
connection.
The WebSocket.readyState
read-only property returns the current state of the WebSocket
connection.
One of the following unsigned short
values:
Value | State | Description |
---|---|---|
0 | CONNECTING | Socket has been created. The connection is not yet open. |
1 | OPEN | The connection is open and ready to communicate. |
2 | CLOSING | The connection is in the process of closing. |
3 | CLOSED | The connection is closed or couldn't be opened. |
Specification |
---|
WebSockets Standard # ref-for-dom-websocket-readystate① |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
readyState |
5 | 12 | 7 | 10 | 12.1 | 5 | 4.4 | 18 | 7 | 12.1 | 4.2 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState