Skip to content

Commit

Permalink
Signal event on Ping/Pong timeout disconnection
Browse files Browse the repository at this point in the history
Wake up any threads that use blocking receive() when a Ping/Pong timeout occurs
  • Loading branch information
lkedziora committed Nov 16, 2023
1 parent a9483e5 commit adacdc3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/simple_websocket/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit adacdc3

Please sign in to comment.