Merge changes about wamp reconnecting options, and added missing parts so that these changes make sense.
authorEdouard Tisserant
Tue, 19 Oct 2021 15:15:03 +0200
changeset 3343 c6de1a6cb655
parent 3341 dce1d5413310 (diff)
parent 3342 d8e99ecde9a2 (current diff)
child 3344 4a08728a2ea4
child 3345 574782d2be1d
Merge changes about wamp reconnecting options, and added missing parts so that these changes make sense.
runtime/WampClient.py
--- a/runtime/WampClient.py	Mon Oct 11 09:04:53 2021 +0200
+++ b/runtime/WampClient.py	Tue Oct 19 15:15:03 2021 +0200
@@ -75,7 +75,14 @@
     "ID": "wamptest",
     "active": False,
     "realm": "Automation",
-    "url": "ws://127.0.0.1:8888"
+    "url": "ws://127.0.0.1:8888",
+    "clientFactoryOptions": {
+        "maxDelay": 300
+    },
+    "protocolOptions": {
+        "autoPingInterval": 10,
+        "autoPingTimeout": 5
+    }
 }
 
 # Those two lists are meant to be filled by customized runtime
@@ -180,7 +187,8 @@
 
     def setClientFactoryOptions(self, options):
         for key, value in options.items():
-            setattr(self, key, value)
+            if key in ["maxDelay", "initialDelay", "maxRetries", "factor", "jitter"]:
+                setattr(self, key, value)
 
     def buildProtocol(self, addr):
         self.resetDelay()
@@ -218,7 +226,7 @@
     if os.path.exists(_WampConf):
         try: 
             WampClientConf = json.load(open(_WampConf))
-	    UpdateWithDefault(WampClientConf, defaultWampConfig)
+            UpdateWithDefault(WampClientConf, defaultWampConfig)
         except ValueError:
             pass
 
@@ -378,7 +386,12 @@
 
 # WEB CONFIGURATION INTERFACE
 WAMP_SECRET_URL = "secret"
-webExposedConfigItems = ['active', 'url', 'ID']
+webExposedConfigItems = [
+    'active', 'url', 'ID',
+    "clientFactoryOptions.maxDelay",
+    "protocolOptions.autoPingInterval",
+    "protocolOptions.autoPingTimeout"
+]
 
 
 def wampConfigDefault(ctx, argument):
@@ -460,8 +473,17 @@
                       default=wampConfigDefault)),
     ("url",
      annotate.String(label=_("WAMP Server URL"),
-                     default=wampConfigDefault))]
-
+                     default=wampConfigDefault)),
+    ("clientFactoryOptions.maxDelay",
+     annotate.Integer(label=_("Max reconnection delay (s)"),
+                      default=wampConfigDefault)),
+    ("protocolOptions.autoPingInterval",
+     annotate.Integer(label=_("Auto ping interval (s)"),
+                      default=wampConfigDefault)),
+    ("protocolOptions.autoPingTimeout",
+     annotate.Integer(label=_("Auto ping timeout (s)"),
+                      default=wampConfigDefault))
+    ]
 
 def deliverWampSecret(ctx, segments):
     # filename = segments[1].decode('utf-8')
--- a/svghmi/svghmi.py	Mon Oct 11 09:04:53 2021 +0200
+++ b/svghmi/svghmi.py	Tue Oct 19 15:15:03 2021 +0200
@@ -56,6 +56,8 @@
     def Generate_C(self, buildpath, varlist, IECCFLAGS):
         global hmi_tree_root, on_hmitree_update, maxConnectionsTotal
 
+        maxConnectionsTotal = 0
+
         already_found_watchdog = False
         found_SVGHMI_instance = False
         for CTNChild in self.GetCTR().IterChildren():