--- a/runtime/WampClient.py Sun Feb 08 16:50:54 2015 +0100
+++ b/runtime/WampClient.py Sun Feb 08 22:39:17 2015 +0100
@@ -8,6 +8,7 @@
from twisted.internet.defer import inlineCallbacks
from autobahn.wamp import types
from autobahn.wamp.serializer import MsgPackSerializer
+from twisted.internet.protocol import ReconnectingClientFactory
import json
_WampSession = None
@@ -23,6 +24,7 @@
"GetTraceVariables",
"RemoteExec",
"GetLogMessage",
+ "ResetLogCount",
]
def MakeCallee(name):
@@ -47,6 +49,14 @@
_WampSession = None
print 'WAMP session left'
+class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
+ def clientConnectionFailed(self, connector, reason):
+ print("WAMP Client connection failed .. retrying ..")
+ self.retry(connector)
+ def clientConnectionLost(self, connector, reason):
+ print("WAMP Client connection lost .. retrying ..")
+ self.retry(connector)
+
def RegisterWampClient(wampconf):
WSClientConf = json.load(open(wampconf))
@@ -63,7 +73,7 @@
session_factory.session = WampSession
# create a WAMP-over-WebSocket transport client factory
- transport_factory = WampWebSocketClientFactory(
+ transport_factory = ReconnectingWampWebSocketClientFactory(
session_factory,
url = WSClientConf["url"],
serializers = [MsgPackSerializer()],