WAMP : prefix callee names with given ID so that multiple PLC and IDE can join the same realm
authorEdouard Tisserant
Mon, 09 Feb 2015 10:55:06 +0100
changeset 1443 ff8a22d45c44
parent 1442 ad9a7853dea2
child 1444 c162f1b0fbac
WAMP : prefix callee names with given ID so that multiple PLC and IDE can join the same realm
connectors/WAMP/__init__.py
runtime/WampClient.py
--- a/connectors/WAMP/__init__.py	Mon Feb 09 00:45:03 2015 +0100
+++ b/connectors/WAMP/__init__.py	Mon Feb 09 10:55:06 2015 +0100
@@ -96,12 +96,13 @@
         reactor.run(installSignalHandlers=False)
 
     def WampSessionProcMapper(funcname):
+        wampfuncname = '.'.join((ID,funcname))
         def catcher_func(*args,**kwargs):
             global _WampSession
             if _WampSession is not None :
                 try:
                     return threads.blockingCallFromThread(
-                        reactor, _WampSession.call, funcname,
+                        reactor, _WampSession.call, wampfuncname,
                         *args,**kwargs)
                 except TransportLost, e:
                     confnodesroot.logger.write_error("Connection lost!\n")
--- a/runtime/WampClient.py	Mon Feb 09 00:45:03 2015 +0100
+++ b/runtime/WampClient.py	Mon Feb 09 10:55:06 2015 +0100
@@ -40,9 +40,10 @@
     def onJoin(self, details):
         global _WampSession
         _WampSession = self
-        print 'WAMP session joined by :', self.config.extra["ID"]
+        ID = self.config.extra["ID"]
+        print 'WAMP session joined by :', ID
         for name in ExposedCalls:
-            reg = yield self.register(MakeCallee(name), name)
+            reg = yield self.register(MakeCallee(name), '.'.join((ID,name)))
 
     def onLeave(self, details):
         global _WampSession