runtime/WampClient.py
changeset 1446 4963e3816641
parent 1445 e25479e3fe11
child 1511 91538d0c242c
--- a/runtime/WampClient.py	Tue Feb 10 00:25:17 2015 +0100
+++ b/runtime/WampClient.py	Mon Feb 16 16:23:51 2015 +0100
@@ -27,7 +27,12 @@
                 "ResetLogCount",
                 ]
 
+SubscribedEvents = []
+
+DoOnJoin = []
+
 def GetCallee(name):
+    """ Get Callee or Subscriber corresponding to '.' spearated object path """
     global _PySrv
     names = name.split('.')
     obj = _PySrv.plcobj
@@ -45,6 +50,12 @@
         for name in ExposedCalls:
             reg = yield self.register(GetCallee(name), '.'.join((ID,name)))
 
+        for name in SubscribedEvents:
+            reg = yield self.subscribe(GetCallee(name), name)
+
+        for func in DoOnJoin:
+            yield func(self)
+
     def onLeave(self, details):
         global _WampSession
         _WampSession = None
@@ -58,9 +69,14 @@
         print("WAMP Client connection lost .. retrying ..")
         self.retry(connector)
 
+def LoadWampClientConf(wampconf):
+
+    WSClientConf = json.load(open(wampconf))
+    return WSClientConf
+
 def RegisterWampClient(wampconf):
 
-    WSClientConf = json.load(open(wampconf))
+    WSClientConf = LoadWampClientConf(wampconf)
 
     ## start logging to console
     # log.startLogging(sys.stdout)