@@ 70,6 70,7 @@ class Websocket:
self._connecting.notify_all()
self._attempts = 0
await self.listen(ws, event_handler)
+ self._connected = False
async def _initial_connect_sequence(self, ws: aiohttp.ClientWebSocketResponse):
self._seq_cursor = 1
@@ 113,7 114,7 @@ class Websocket:
fut.set_result(payload)
async def __request(self, action: str, data: Optional[dict] = None):
- if not self._connected:
+ if not self._connected or self._ws and self._ws.closed:
async with self._connecting:
await self._connecting.wait()
assert self._ws is not None