Web APIs

WebSocket.readyState

Try the free JavaScript compiler

Numeric connection state, compared with the WebSocket state constants.

Formal Syntax & Structure

javascript syntaxjavascript
socket.readyState

Return Value

number

Numeric connection state, compared with the WebSocket state constants.

Working Example

Example Snippetjavascript
(async () => {console.log([WebSocket.CONNECTING,WebSocket.OPEN,WebSocket.CLOSING,WebSocket.CLOSED].join(","));})()
JavaScript Reference