runtime/Wamp : adapt to unicode being enforced in latest crossbar API. Updated some documentation, to explain why there is unused definitions like SubscribedEvents or DoOnJoin.
authorEdouard Tisserant
Thu, 11 Jan 2018 12:48:49 +0100
changeset 1898 d2dbdeffc426
parent 1897 62f9cae9a25f
child 1899 ff4410112b67
runtime/Wamp : adapt to unicode being enforced in latest crossbar API. Updated some documentation, to explain why there is unused definitions like SubscribedEvents or DoOnJoin.
runtime/WampClient.py
--- a/runtime/WampClient.py	Wed Jan 10 15:36:03 2018 +0100
+++ b/runtime/WampClient.py	Thu Jan 11 12:48:49 2018 +0100
@@ -54,8 +54,13 @@
     "ResetLogCount",
 ]
 
+# Those two lists are meant to be filled by customized runtime
+# or User python code. 
+
+""" crossbar Events to register to """  
 SubscribedEvents = []
 
+""" things to do on join (callables) """  
 DoOnJoin = []
 
 
@@ -88,14 +93,14 @@
     def onJoin(self, details):
         global _WampSession
         _WampSession = self
-        ID = self.config.extra["ID"]
+        ID = self.config.extra["ID"] # this is unicode
         print('WAMP session joined by :', ID)
         for name in ExposedCalls:
             regoption = types.RegisterOptions(u'exact',u'last',None, None)
-            yield self.register(GetCallee(name), '.'.join((ID, name)), regoption)
+            yield self.register(GetCallee(name), u'.'.join((ID, name)), regoption)
 
         for name in SubscribedEvents:
-            yield self.subscribe(GetCallee(name), name)
+            yield self.subscribe(GetCallee(name), unicode(name))
 
         for func in DoOnJoin:
             yield func(self)
@@ -150,7 +155,7 @@
     # create a WAMP application session factory
     component_config = types.ComponentConfig(
         realm=WSClientConf["realm"],
-        extra=WSClientConf)
+        extra=WSClientConf) # pass a dict containing unicode values
     session_factory = wamp.ApplicationSessionFactory(
         config=component_config)
     session_factory.session = WampSession