當前位置: 首頁>>代碼示例>>Python>>正文


Python WampWebSocketServerProtocol.connectionLost方法代碼示例

本文整理匯總了Python中autobahn.twisted.websocket.WampWebSocketServerProtocol.connectionLost方法的典型用法代碼示例。如果您正苦於以下問題:Python WampWebSocketServerProtocol.connectionLost方法的具體用法?Python WampWebSocketServerProtocol.connectionLost怎麽用?Python WampWebSocketServerProtocol.connectionLost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在autobahn.twisted.websocket.WampWebSocketServerProtocol的用法示例。


在下文中一共展示了WampWebSocketServerProtocol.connectionLost方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: connectionLost

# 需要導入模塊: from autobahn.twisted.websocket import WampWebSocketServerProtocol [as 別名]
# 或者: from autobahn.twisted.websocket.WampWebSocketServerProtocol import connectionLost [as 別名]
 def connectionLost(self, reason):
    try:
       log.msg("Connection to node controller lost.")
       WampWebSocketServerProtocol.connectionLost(self, reason)
    except:
       pass
    finally:
       ## loosing the connection to the node controller (the pipes) is fatal.
       ## stop the reactor and exit with error
       if reactor.running:
          reactor.addSystemEventTrigger('after', 'shutdown', os._exit, 1)
          reactor.stop()
       else:
          sys.exit(1)
開發者ID:rogererens,項目名稱:crossbar,代碼行數:16,代碼來源:process.py

示例2: connectionLost

# 需要導入模塊: from autobahn.twisted.websocket import WampWebSocketServerProtocol [as 別名]
# 或者: from autobahn.twisted.websocket.WampWebSocketServerProtocol import connectionLost [as 別名]
 def connectionLost(self, reason):
     try:
         # this log message is unlikely to reach the controller (unless
         # only stdin/stdout pipes were lost, but not stderr)
         log.msg("Connection to node controller lost.")
         WampWebSocketServerProtocol.connectionLost(self, reason)
     except:
         pass
     finally:
         # loosing the connection to the node controller is fatal:
         # stop the reactor and exit with error
         if reactor.running:
             reactor.addSystemEventTrigger('after', 'shutdown', os._exit, 1)
             reactor.stop()
開發者ID:OspreyX,項目名稱:crossbar,代碼行數:16,代碼來源:process.py

示例3: connectionLost

# 需要導入模塊: from autobahn.twisted.websocket import WampWebSocketServerProtocol [as 別名]
# 或者: from autobahn.twisted.websocket.WampWebSocketServerProtocol import connectionLost [as 別名]
        def connectionLost(self, reason):
            # the behavior here differs slightly whether we're shutting down orderly
            # or shutting down because of "issues"
            if isinstance(reason.value, ConnectionDone):
                was_clean = True
            else:
                was_clean = False

            try:
                # this log message is unlikely to reach the controller (unless
                # only stdin/stdout pipes were lost, but not stderr)
                if was_clean:
                    log.info("Connection to node controller closed cleanly")
                else:
                    log.warn("Connection to node controller lost: {reason}", reason=reason)

                # give the WAMP transport a change to do it's thing
                WampWebSocketServerProtocol.connectionLost(self, reason)
            except:
                # we're in the process of shutting down .. so ignore ..
                pass
            finally:
                # after the connection to the node controller is gone,
                # the worker is "orphane", and should exit

                # determine process exit code
                if was_clean:
                    exit_code = 0
                else:
                    exit_code = 1

                # exit the whole worker process when the reactor has stopped
                reactor.addSystemEventTrigger('after', 'shutdown', os._exit, exit_code)

                # stop the reactor
                try:
                    reactor.stop()
                except ReactorNotRunning:
                    pass
開發者ID:abhimanyu-siwach,項目名稱:crossbar,代碼行數:41,代碼來源:process.py

示例4: connectionLost

# 需要導入模塊: from autobahn.twisted.websocket import WampWebSocketServerProtocol [as 別名]
# 或者: from autobahn.twisted.websocket.WampWebSocketServerProtocol import connectionLost [as 別名]
 def connectionLost(self, reason):
     WampWebSocketServerProtocol.connectionLost(self, reason)
     self.factory.connectionLost(reason)
開發者ID:growlercab,項目名稱:VTK,代碼行數:5,代碼來源:wamp.py


注:本文中的autobahn.twisted.websocket.WampWebSocketServerProtocol.connectionLost方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。