property
ServerWebSocket.readyState
readonly readyState: WebSocketReadyState
The ready state of the client.
- if
1, the client is connected. - if
3, the client is closed, orclose()orterminate()was called.
A ServerWebSocket is never 0 (connecting) or 2 (closing).
console.log(socket.readyState); // 1