The WebSocket.readyState read-only property returns the current state of the WebSocket connection.
WebSocket.readyState
external int get readyState;