websocket.py: add ping callback support

This commit is contained in:
Thomas Farstrike
2025-05-30 21:39:19 +02:00
parent 36607cb5f9
commit db925ce9fb
+3
View File
@@ -328,6 +328,9 @@ class WebSocketApp:
elif msg.type == WSMsgType.ERROR or ws.ws.closed:
_log_error("WebSocket error or closed")
raise WebSocketConnectionClosedException("WebSocket closed")
elif msg.type == ABNF.OPCODE_PING:
data = msg.data
_run_callback(self.on_ping, self, data, ABNF.OPCODE_PING, True)
async def _send_async(self, data, opcode):
"""Async send implementation."""