diff --git a/connector/systembridgeconnector/websocket_client.py b/connector/systembridgeconnector/websocket_client.py index a88872bdf..ddf5dacc6 100644 --- a/connector/systembridgeconnector/websocket_client.py +++ b/connector/systembridgeconnector/websocket_client.py @@ -267,7 +267,10 @@ async def receive_message(self) -> dict | None: if self._websocket is None: return None - message = await self._websocket.receive() + try: + message = await self._websocket.receive() + except RuntimeError: + return None if message.type == aiohttp.WSMsgType.ERROR: raise ConnectionErrorException(self._websocket.exception()) diff --git a/shared/systembridgeshared/websocket_client.py b/shared/systembridgeshared/websocket_client.py index e8bf66002..9a4dff544 100644 --- a/shared/systembridgeshared/websocket_client.py +++ b/shared/systembridgeshared/websocket_client.py @@ -266,7 +266,10 @@ async def receive_message(self) -> dict | None: if self._websocket is None: return None - message = await self._websocket.receive() + try: + message = await self._websocket.receive() + except RuntimeError: + return None if message.type == aiohttp.WSMsgType.ERROR: raise ConnectionErrorException(self._websocket.exception())