runtime/WampClient.py
changeset 1740 b789b695b5c6
parent 1736 7e61baa047f0
child 1744 69dfdb26f600
equal deleted inserted replaced
1739:ec153828ded2 1740:b789b695b5c6
    68         global _WampSession
    68         global _WampSession
    69         _WampSession = self
    69         _WampSession = self
    70         ID = self.config.extra["ID"]
    70         ID = self.config.extra["ID"]
    71         print 'WAMP session joined by :', ID
    71         print 'WAMP session joined by :', ID
    72         for name in ExposedCalls:
    72         for name in ExposedCalls:
    73             reg = yield self.register(GetCallee(name), '.'.join((ID,name)))
    73             reg = yield self.register(GetCallee(name), '.'.join((ID, name)))
    74 
    74 
    75         for name in SubscribedEvents:
    75         for name in SubscribedEvents:
    76             reg = yield self.subscribe(GetCallee(name), name)
    76             reg = yield self.subscribe(GetCallee(name), name)
    77 
    77 
    78         for func in DoOnJoin:
    78         for func in DoOnJoin:
   107     # log.startLogging(sys.stdout)
   107     # log.startLogging(sys.stdout)
   108 
   108 
   109     # create a WAMP application session factory
   109     # create a WAMP application session factory
   110     component_config = types.ComponentConfig(
   110     component_config = types.ComponentConfig(
   111         realm = WSClientConf["realm"],
   111         realm = WSClientConf["realm"],
   112         extra = {"ID":WSClientConf["ID"]})
   112         extra = {"ID": WSClientConf["ID"]})
   113     session_factory = wamp.ApplicationSessionFactory(
   113     session_factory = wamp.ApplicationSessionFactory(
   114         config = component_config)
   114         config = component_config)
   115     session_factory.session = WampSession
   115     session_factory.session = WampSession
   116 
   116 
   117     # create a WAMP-over-WebSocket transport client factory
   117     # create a WAMP-over-WebSocket transport client factory
   122         debug = False,
   122         debug = False,
   123         debug_wamp = False)
   123         debug_wamp = False)
   124 
   124 
   125     # start the client from a Twisted endpoint
   125     # start the client from a Twisted endpoint
   126     conn = connectWS(transport_factory)
   126     conn = connectWS(transport_factory)
   127     print "WAMP client connecting to :",WSClientConf["url"]
   127     print "WAMP client connecting to :", WSClientConf["url"]
   128     return conn
   128     return conn
   129 
   129 
   130 
   130 
   131 def GetSession():
   131 def GetSession():
   132     global _WampSession
   132     global _WampSession