本文整理汇总了Python中autobahn.websocket.WebSocketServerProtocol.connectionLost方法的典型用法代码示例。如果您正苦于以下问题:Python WebSocketServerProtocol.connectionLost方法的具体用法?Python WebSocketServerProtocol.connectionLost怎么用?Python WebSocketServerProtocol.connectionLost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autobahn.websocket.WebSocketServerProtocol
的用法示例。
在下文中一共展示了WebSocketServerProtocol.connectionLost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
try:
self.factory.clients.remove(self)
except ValueError:
# client doesn't exist, pass
pass
WebSocketServerProtocol.connectionLost(self, reason)
示例2: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
envelopes = handler.unregisterClient(self)
self.factory.sendEnvelopes(envelopes)
self.factory.unregister(self)
示例3: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
if self.room:
self.factory.broadcast(self.room.setOnline(self.name, False), self.room.name, self)
if self.room.empty():
self.factory.roomEmpty(self.room.name)
self.factory.unregister(self)
示例4: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
self.factory.stats.trackOctetsWireIn(self.trafficStats.preopenIncomingOctetsWireLevel + \
self.trafficStats.incomingOctetsWireLevel)
self.factory.stats.trackOctetsWireOut(self.trafficStats.preopenOutgoingOctetsWireLevel + \
self.trafficStats.outgoingOctetsWireLevel)
示例5: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
if self.connected:
self.room.user_disconnect(self.user_session)
self.connected = False
self.user_session = None
self.room = None
示例6: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
"""
Unregister each client (self) as it disconnects.
"""
WebSocketServerProtocol.connectionLost(self, reason)
self.factory.unregister(self)
示例7: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
try:
del self.factory.posdict[self.peerstr]
except KeyError:
pass
try:
del self.factory.statedict[self.peerstr]
except KeyError:
pass
self.factory.unregister(self)
示例8: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
global serial_port
global serial_device
global serial_baudrate
if not self.connection_invalid:
print "Disconnect Message Received"
if serial_port != None:
oldserial = serial_port
serial_port = None
serial_device = None
serial_baudrate = None
self.read_thread.stop()
self.read_thread.join()
oldserial.close()
WebSocketServerProtocol.connectionLost(self, reason)
示例9: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
self.send_hello = False
示例10: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
self.factory.handle_request_end(self)
示例11: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
'''Override function.
'''
WebSocketServerProtocol.connectionLost(self, reason)
self.factory.unregister(self)
示例12: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason=None):
WebSocketServerProtocol.connectionLost(self, reason)
if self in self.factory.clients:
self.factory.clients.remove(self)
示例13: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
#super(WebSocketProcessOutputterThing, self).connectionLost(self, reason)
self.factory.unregister(self)
示例14: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
self.factory.leave(self.peer)
示例15: connectionLost
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import connectionLost [as 别名]
def connectionLost(self, reason):
WebSocketServerProtocol.connectionLost(self, reason)
print "Connection lost, reason", reason