From adacdc302aeaf5119d3c4d5cab51496d82d375c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20K=C4=99dziora?= Date: Wed, 15 Nov 2023 14:28:32 +0100 Subject: [PATCH] Signal event on Ping/Pong timeout disconnection Wake up any threads that use blocking receive() when a Ping/Pong timeout occurs --- src/simple_websocket/ws.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/simple_websocket/ws.py b/src/simple_websocket/ws.py index 627f53d..b57f754 100644 --- a/src/simple_websocket/ws.py +++ b/src/simple_websocket/ws.py @@ -143,6 +143,7 @@ def _thread(self): if not self.pong_received: self.close(reason=CloseReason.POLICY_VIOLATION, message='Ping/Pong timeout') + self.event.set() break self.pong_received = False self.sock.send(self.ws.send(Ping()))