diff --git a/engineio/asyncio_client.py b/engineio/asyncio_client.py index fdd26284..62067b05 100644 --- a/engineio/asyncio_client.py +++ b/engineio/asyncio_client.py @@ -635,7 +635,8 @@ async def _write_loop(self): await self.ws.send_str(pkt.encode( always_bytes=False)) self.queue.task_done() - except aiohttp.client_exceptions.ServerDisconnectedError: + except (aiohttp.client_exceptions.ServerDisconnectedError, + BrokenPipeError, OSError): self.logger.info( 'Write loop: WebSocket connection was closed, ' 'aborting') diff --git a/engineio/client.py b/engineio/client.py index 62c29cbe..20150899 100644 --- a/engineio/client.py +++ b/engineio/client.py @@ -741,7 +741,8 @@ def _write_loop(self): else: self.ws.send(encoded_packet) self.queue.task_done() - except websocket.WebSocketConnectionClosedException: + except (websocket.WebSocketConnectionClosedException, + BrokenPipeError, OSError): self.logger.warning( 'WebSocket connection was closed, aborting') break