本文整理汇总了Python中autobahn.websocket.WebSocketServerProtocol.onConnect方法的典型用法代码示例。如果您正苦于以下问题:Python WebSocketServerProtocol.onConnect方法的具体用法?Python WebSocketServerProtocol.onConnect怎么用?Python WebSocketServerProtocol.onConnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autobahn.websocket.WebSocketServerProtocol
的用法示例。
在下文中一共展示了WebSocketServerProtocol.onConnect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onConnect
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import onConnect [as 别名]
def onConnect(self, request):
print "+++++++++++++++++++++++++++++++++++++++++++"
print "\nrequest: %s\n" % request
print "+++++++++++++++++++++++++++++++++++++++++++"
# Restrict to sections 1, 2 & 3?
WebSocketServerProtocol.onConnect(self, request)
if 'controller' in request.path:
self.admin = True
self.factory.register_admin(self)
elif 'section' in request.path:
section = int(request.path.split('section/')[1])
self.word = choice(words.words)
self.factory.register(self, section)
# Send our session's request key to provide extremely basic message
# signing from clients
payload = get_payload(config.socket_key)
payload['cmd'] = 'store'
self.sendMessage(payload)
示例2: onConnect
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import onConnect [as 别名]
def onConnect(self, connectionRequest):
print "Received connection request", connectionRequest.headers
return WebSocketServerProtocol.onConnect(self, connectionRequest)
示例3: onConnect
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import onConnect [as 别名]
def onConnect(self, connectionRequest):
print 'on connect...%s %s' %(connectionRequest.host, connectionRequest.path)
WebSocketServerProtocol.onConnect(self, connectionRequest)
示例4: onConnect
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import onConnect [as 别名]
def onConnect(self, request):
WebSocketServerProtocol.onConnect(self, request)
self.factory.clients.append(self)
self.api = self.factory.api
示例5: onConnect
# 需要导入模块: from autobahn.websocket import WebSocketServerProtocol [as 别名]
# 或者: from autobahn.websocket.WebSocketServerProtocol import onConnect [as 别名]
def onConnect(self, req):
print 'open'
self.player = None
return WebSocketServerProtocol.onConnect(self, req)