From: Benjamin Braatz Date: Wed, 19 Jul 2023 13:29:20 +0000 (+0200) Subject: Shorter ping to detect connection drops faster. X-Git-Tag: v0.3.0 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=cc9c0808cbd263f49134ea405b904f7918dee449;p=graphit%2Fcontrolpi-wsclient.git Shorter ping to detect connection drops faster. --- 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': ''}