runtime/WampClient.py
changeset 1890 916099cb8d22
parent 1881 091005ec69c4
child 1891 66043243c246
equal deleted inserted replaced
1889:baff54446535 1890:916099cb8d22
    83             yield func(self)
    83             yield func(self)
    84 
    84 
    85     def onLeave(self, details):
    85     def onLeave(self, details):
    86         global _WampSession
    86         global _WampSession
    87         _WampSession = None
    87         _WampSession = None
    88         print('WAMP session left')
    88         print(_('WAMP session left'))
    89 
    89 
    90 
    90 
    91 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
    91 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
    92     def clientConnectionFailed(self, connector, reason):
    92     def clientConnectionFailed(self, connector, reason):
    93         print("WAMP Client connection failed .. retrying ..")
       
    94         self.retry(connector)
    93         self.retry(connector)
       
    94         print(_("WAMP Client connection failed .. retrying .."))
    95 
    95 
    96     def clientConnectionLost(self, connector, reason):
    96     def clientConnectionLost(self, connector, reason):
    97         print("WAMP Client connection lost .. retrying ..")
       
    98         self.retry(connector)
    97         self.retry(connector)
       
    98         print(_("WAMP Client connection lost .. retrying .."))
    99 
    99 
   100 
   100 
   101 def LoadWampClientConf(wampconf):
   101 def LoadWampClientConf(wampconf):
   102 
   102 
   103     WSClientConf = json.load(open(wampconf))
   103     WSClientConf = json.load(open(wampconf))
   127         debug=False,
   127         debug=False,
   128         debug_wamp=False)
   128         debug_wamp=False)
   129 
   129 
   130     # start the client from a Twisted endpoint
   130     # start the client from a Twisted endpoint
   131     conn = connectWS(transport_factory)
   131     conn = connectWS(transport_factory)
   132     print("WAMP client connecting to :", WSClientConf["url"])
   132     print(_("WAMP client connecting to :"), _WSClientConf["url"])
   133     return conn
   133     return conn
   134 
   134 
   135 
   135 
   136 def GetSession():
   136 def GetSession():
   137     return _WampSession
   137     return _WampSession