From cc9c0808cbd263f49134ea405b904f7918dee449 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 19 Jul 2023 15:29:20 +0200 Subject: [PATCH] Shorter ping to detect connection drops faster. --- controlpi_plugins/wsclient.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controlpi_plugins/wsclient.py b/controlpi_plugins/wsclient.py index 29ced74..a6919cb 100644 --- a/controlpi_plugins/wsclient.py +++ b/controlpi_plugins/wsclient.py @@ -193,7 +193,8 @@ class WSClient(BasePlugin): async def run(self) -> None: """Connect to wsserver and process messages from it.""" - async for websocket in connect(self.conf['url']): + async for websocket in connect(self.conf['url'], + ping_interval=1, ping_timeout=5): try: conf_command: Dict[str, Any] = \ {'command': 'configure websocket', 'target': ''} -- 2.34.1