runtime/WampClient.py
changeset 2537 eb4a4cc41914
parent 2487 6a4f9a061994
child 2581 20eb4e7a0647
equal deleted inserted replaced
2536:2747d6e72eb8 2537:eb4a4cc41914
   133                 print(_("TypeError register option: {}".format(e)))
   133                 print(_("TypeError register option: {}".format(e)))
   134 
   134 
   135             self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
   135             self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
   136 
   136 
   137         for name in SubscribedEvents:
   137         for name in SubscribedEvents:
   138             self.subscribe(GetCallee(name), unicode(name))
   138             self.subscribe(GetCallee(name), text(name))
   139 
   139 
   140         for func in DoOnJoin:
   140         for func in DoOnJoin:
   141             func(self)
   141             func(self)
   142 
   142 
   143         print(_('WAMP session joined (%s) by:' % time.ctime()), ID)
   143         print(_('WAMP session joined (%s) by:' % time.ctime()), ID)
   149         _transportFactory = None
   149         _transportFactory = None
   150         print(_('WAMP session left'))
   150         print(_('WAMP session left'))
   151 
   151 
   152     def publishWithOwnID(self, eventID, value):
   152     def publishWithOwnID(self, eventID, value):
   153         ID = self.config.extra["ID"]
   153         ID = self.config.extra["ID"]
   154         self.publish(unicode(ID+'.'+eventID), value)
   154         self.publish(text(ID+'.'+eventID), value)
   155 
   155 
   156 
   156 
   157 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
   157 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
   158 
   158 
   159     def __init__(self, config, *args, **kwargs):
   159     def __init__(self, config, *args, **kwargs):
   341     _PySrv = pysrv
   341     _PySrv = pysrv
   342 
   342 
   343 
   343 
   344 def PublishEvent(eventID, value):
   344 def PublishEvent(eventID, value):
   345     if getWampStatus() == "Attached":
   345     if getWampStatus() == "Attached":
   346         _WampSession.publish(unicode(eventID), value)
   346         _WampSession.publish(text(eventID), value)
   347 
   347 
   348 
   348 
   349 def PublishEventWithOwnID(eventID, value):
   349 def PublishEventWithOwnID(eventID, value):
   350     if getWampStatus() == "Attached":
   350     if getWampStatus() == "Attached":
   351         _WampSession.publishWithOwnID(unicode(eventID), value)
   351         _WampSession.publishWithOwnID(text(eventID), value)
   352 
   352 
   353 
   353 
   354 # WEB CONFIGURATION INTERFACE
   354 # WEB CONFIGURATION INTERFACE
   355 WAMP_SECRET_URL = "secret"
   355 WAMP_SECRET_URL = "secret"
   356 webExposedConfigItems = ['active', 'url', 'ID']
   356 webExposedConfigItems = ['active', 'url', 'ID']