Shorter ping to detect connection drops faster. v0.3.0
authorBenjamin Braatz <benjamin.braatz@graph-it.com>
Wed, 19 Jul 2023 13:29:20 +0000 (15:29 +0200)
committerBenjamin Braatz <benjamin.braatz@graph-it.com>
Wed, 19 Jul 2023 13:29:20 +0000 (15:29 +0200)
controlpi_plugins/wsclient.py

index 29ced7488555a2a6c0f4e5ccc6fc8cfb7cbaa2b7..a6919cbbe6d485b40cca58209b7a2732123a6902 100644 (file)
@@ -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': ''}