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


Python websocket.WebSocketServerProtocol类代码示例

本文整理汇总了Python中autobahn.websocket.WebSocketServerProtocol的典型用法代码示例。如果您正苦于以下问题:Python WebSocketServerProtocol类的具体用法?Python WebSocketServerProtocol怎么用?Python WebSocketServerProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WebSocketServerProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectionLost

    def connectionLost(self, reason):
        WebSocketServerProtocol.connectionLost(self, reason)

        envelopes = handler.unregisterClient(self)
        self.factory.sendEnvelopes(envelopes)

        self.factory.unregister(self)
开发者ID:cmacrander,项目名称:common_boards,代码行数:7,代码来源:server.py

示例2: connectionLost

	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)
开发者ID:popoffka,项目名称:ponydraw,代码行数:7,代码来源:server.py

示例3: connectionLost

	def connectionLost(self, reason):
		try:
			self.factory.clients.remove(self)
		except ValueError:
			# client doesn't exist, pass
			pass
		WebSocketServerProtocol.connectionLost(self, reason)
开发者ID:JohnTocher,项目名称:cbus,代码行数:7,代码来源:saged.py

示例4: sendMessage

    def sendMessage(self, payload, binary=False):
        if isinstance(payload, dict) and not binary:
            msg = json.dumps(payload)
        else:
            msg = json.dumps({'message': payload})

        WebSocketServerProtocol.sendMessage(self, msg, binary=binary)
开发者ID:alex-laties,项目名称:MMFE,代码行数:7,代码来源:protocol.py

示例5: connectionLost

   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)
开发者ID:WilliamRen,项目名称:AutobahnPython,代码行数:8,代码来源:server.py

示例6: onMessageBegin

 def onMessageBegin(self, opcode):
    WebSocketServerProtocol.onMessageBegin(self, opcode)
    if COMPUTE_HASH:
       self.sha256 = hashlib.sha256()
    else:
       self.sha256 = None
    self.count = 0
    self.received = 0
    self.next = BATCH_SIZE
开发者ID:luodaobin,项目名称:scratchbox,代码行数:9,代码来源:streaming_server.py

示例7: connectionLost

	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
开发者ID:jwmcglynn,项目名称:videosync,代码行数:9,代码来源:client_connection.py

示例8: connectionLost

    def connectionLost(self, reason):

        """

        Unregister each client (self) as it disconnects.

        """

        WebSocketServerProtocol.connectionLost(self, reason)
        self.factory.unregister(self)
开发者ID:jomido,项目名称:tswss,代码行数:10,代码来源:server.py

示例9: onClose

    def onClose(self, wasClean, code, reason):
        """Connect closed, cleanup"""
        # base logs
        WebSocketServerProtocol.onClose(self, wasClean, code, reason)
        if self.client is None:
            if self.debug:
                log.msg("MSP430ServerProtocol.onClose - No Client type")
            return

        self.client.onClose(wasClean, code, reason)
开发者ID:zlalanne,项目名称:msp430-webcontrol,代码行数:10,代码来源:server_protocol.py

示例10: onClose

    def onClose(self, wasClean, code, reason):
#        logline("ONCLOSE: %s" % reason)
        WebSocketServerProtocol.onClose(self, wasClean, code, reason)
        delkey = None
        for key in connections:
            if connections[key]['wsh'] == self:
                delkey = key
        if delkey:
            del connections[delkey]
            logline("jsdb client %s disconnected." % delkey)
开发者ID:rlgomes,项目名称:jsdb,代码行数:10,代码来源:jsdb.py

示例11: connectionMade

 def connectionMade(self):
     self.configuration = self.configuration
     WebSocketServerProtocol.connectionMade(self)
     self.lisaclientfactory = libs.LisaClientFactory(self)
     if self.configuration['enable_secure_mode']:
          self.conn = reactor.connectSSL(self.configuration['lisa_url'], self.configuration['lisa_engine_port_ssl'],
                             self.lisaclientfactory, CtxFactory()
          )
     else:
         self.conn = reactor.connectTCP(self.configuration['lisa_url'],
                            self.configuration['lisa_engine_port'], self.lisaclientfactory)
开发者ID:byackee,项目名称:LISA,代码行数:11,代码来源:websocket.py

示例12: connectionLost

 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)
开发者ID:limnick,项目名称:helicopter,代码行数:11,代码来源:server.py

示例13: sendMessage

 def sendMessage(self, msg):
     """ This method is called by the User instance to send a message to the
         robot.
         
         @param msg:     Message which should be sent
     """
     uriBinary, msgURI = recursiveBinarySearch(msg)
     
     WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))
     
     for binData in uriBinary:
         WebSocketServerProtocol.sendMessage(self,
             binData[0] + binData[1].getvalue(), binary=True)
开发者ID:LCROBOT,项目名称:rce,代码行数:13,代码来源:protocol.py

示例14: connectionLost

	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)
开发者ID:ArduSat,项目名称:python-websocket-daemon,代码行数:16,代码来源:mywinserver.py

示例15: sendMessage

    def sendMessage(self, msg):
        """ Internally used method to send a message to the robot.

            Should not be used from outside the Protocol; instead use the
            methods 'sendDataMessage' or 'sendErrorMessage'.

            (Overwrites method from autobahn.websocket.WebSocketServerProtocol)

            @param msg:     Message which should be sent.
        """
        uriBinary, msgURI = recursiveBinarySearch(msg)

        WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))

        for binData in uriBinary:
            WebSocketServerProtocol.sendMessage(self,
                binData[0] + binData[1].getvalue(), binary=True)
开发者ID:vmayoral,项目名称:rce,代码行数:17,代码来源:server.py


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