当前位置: 首页>>代码示例>>Python>>正文


Python WebSocketServerProtocol.onConnect方法代码示例

本文整理汇总了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)
开发者ID:truetone,项目名称:websocket-console,代码行数:21,代码来源:ws_server.py

示例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)
开发者ID:stuffmatic,项目名称:snacka,代码行数:5,代码来源:echoserver.py

示例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)
开发者ID:nic562,项目名称:FileUpload,代码行数:5,代码来源:websocket.py

示例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
开发者ID:JohnTocher,项目名称:cbus,代码行数:6,代码来源:saged.py

示例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)
开发者ID:forsaken1,项目名称:game,代码行数:6,代码来源:ws_connection.py


注:本文中的autobahn.websocket.WebSocketServerProtocol.onConnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。