readyState

The WebSocket.readyState read-only property returns the current state of the WebSocket connection.

MDN Reference