Deal with closed ws connection while sending

This commit is contained in:
Joscha 2018-07-27 19:22:04 +00:00
parent d9761008f6
commit 7e28c6e3dd

View file

@ -48,7 +48,10 @@ class Connection:
wait_for = self._wait_for_response(pid) wait_for = self._wait_for_response(pid)
logging.debug(f"Currently used websocket at self._ws: {self._ws}") logging.debug(f"Currently used websocket at self._ws: {self._ws}")
await self._ws.send(json.dumps(packet, separators=(',', ':'))) # minimum size try:
await self._ws.send(json.dumps(packet, separators=(',', ':'))) # minimum size
except websockets.ConnectionClosed:
raise ConnectionClosed()
if await_response: if await_response:
await wait_for await wait_for