If we assume the used library follows the WebSocket specs we could compare .readyState to 0
```Javascript
return this.socket.readyState == 0;
```