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


Python WebSocketClientFactory.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
   def __init__(self, url, debug = False, ident = None):
      WebSocketClientFactory.__init__(self, url, useragent = ident, debug = debug, debugCodePaths = debug)
      self.setProtocolOptions(failByDrop = False) # spec conformance

      ## enable permessage-XXX compression extensions
      ##
      offers = [PerMessageDeflateOffer()]
      #offers = [PerMessageSnappyOffer(), PerMessageBzip2Offer(), PerMessageDeflateOffer()]
      self.setProtocolOptions(perMessageCompressionOffers = offers)

      def accept(response):
         if isinstance(response, PerMessageDeflateResponse):
            return PerMessageDeflateResponseAccept(response)

         elif isinstance(response, PerMessageBzip2Response):
            return PerMessageBzip2ResponseAccept(response)

         elif isinstance(response, PerMessageSnappyResponse):
            return PerMessageSnappyResponseAccept(response)

      self.setProtocolOptions(perMessageCompressionAccept = accept)


      self.endCaseId = None
      self.currentCaseId = 0

      self.updateReports = True
      if ident is not None:
         self.agent = ident
      else:
         self.agent = "AutobahnPython/%s" % autobahn.version
      self.resource = "/getCaseCount"
开发者ID:crossbario,项目名称:autobahn-testsuite,代码行数:34,代码来源:testee.py

示例2: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self, url):
   WebSocketClientFactory.__init__(self, url)
   
   self.protocolInstance = None
   self.tickGap = 5
   self.tickSetup()
   
   self.connect()
开发者ID:jessertaylor,项目名称:websocket-kinect,代码行数:10,代码来源:websocket-kinect.py

示例3: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
	def __init__(self, path, debug, debugCodePaths=False):
		WebSocketClientFactory.__init__(self, path, debug=debug, debugCodePaths=False)
	
		try:
			self.sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
			self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
		except:
			log.msg("Error creating raw socket", logLevel=logging.WARN)
开发者ID:marsmensch,项目名称:multitun,代码行数:10,代码来源:multitun.py

示例4: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self, audioFd, summary, contentType, model, url=None, headers=None, debug=None):
        self.listeners = []
        WebSocketClientFactory.__init__(self, url=url, headers=headers, debug=debug)
        self.audioFd = audioFd
        self.summary = summary
        self.contentType = contentType
        self.model = model

        self.openHandshakeTimeout = 6
        self.closeHandshakeTimeout = 6
开发者ID:HomeHabbit,项目名称:stt-watson,代码行数:12,代码来源:WSInterfaceFactory.py

示例5: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self, receiver, url, debug=True):
        """Constructor

        Args:
        receiver: The instance of IARIEventReceiver that will receive updates
        url: The URL to connect the WebSocket to
        debug: Optional. Enable greater debugging in WebSocketClientFactory.
               Defaults to True.
        """
        WebSocketClientFactory.__init__(self, url, debug=debug,
                                        protocols=['ari'])
        self.receiver = receiver
开发者ID:matt-jordan,项目名称:twisted-ari,代码行数:14,代码来源:http_client.py

示例6: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
   def __init__(self, queue, summary, contentType, model, url=None, headers=None, debug=None):

      WebSocketClientFactory.__init__(self, url=url, headers=headers)   
      self.queue = queue
      self.summary = summary
      self.contentType = contentType
      self.model = model
      self.queueProto = Queue.Queue()

      self.openHandshakeTimeout = 10
      self.closeHandshakeTimeout = 10

      # start the thread that takes care of ending the reactor so the script can finish automatically (without ctrl+c)
      endingThread = threading.Thread(target=self.endReactor, args= ())
      endingThread.daemon = True
      endingThread.start()
开发者ID:hungtraan,项目名称:FacebookBot,代码行数:18,代码来源:speech_py.py

示例7: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self, threadID, uri, notificationQ):
        self.threadID = threadID
        self.uri = uri
        self.notification_q = notificationQ
        self.running = True
        WebSocketClientFactory.__init__(self,'ws://'+str(self.uri[7:]))
        threading.Thread.__init__(self)
        self.protocol = MyClientProtocol
        self.setProtocolOptions(openHandshakeTimeout=15)
        print self.uri
        address = self.uri[7:].split('/')[0]
        path =  self.uri[7:].split('/')[1:]

        ip = address.split(':')[0]
        port = address.split(':')[1]

        reactor.connectTCP(ip, int(port), self)
开发者ID:OpenNetworkingFoundation,项目名称:Snowmass-ONFOpenTransport,代码行数:19,代码来源:notification_client.py

示例8: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self):
        logger.info('Initiating Slack RTM start request')
        data = api('rtm.start', no_latest=1)

        # Make the protocol a partial so that we can send the full info from rtm.start
        self.protocol = partial(Client, data)

        logger.info('creating WebSocketClientFactory with %s', data['url'])

        return WebSocketClientFactory.__init__(self, url=data['url'])
开发者ID:bigjust,项目名称:helga,代码行数:12,代码来源:slack.py

示例9: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self, url):
        self.agent = autobahn.twisted.__ident__
        WebSocketClientFactory.__init__(self, url, useragent=self.agent)

        self.setProtocolOptions(failByDrop=False)  # spec conformance

        # enable permessage-deflate WebSocket protocol extension
        offers = [PerMessageDeflateOffer()]
        self.setProtocolOptions(perMessageCompressionOffers=offers)

        def accept(response):
            if isinstance(response, PerMessageDeflateResponse):
                return PerMessageDeflateResponseAccept(response)

        self.setProtocolOptions(perMessageCompressionAccept=accept)

        # setup client testee stuff
        self.endCaseId = None
        self.currentCaseId = 0
        self.updateReports = True
        self.resource = "/getCaseCount"
开发者ID:Alf-11,项目名称:autobahn-python,代码行数:23,代码来源:testee_client.py

示例10: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self.adapter = WebsocketClientAdapter()  # this is the adapter singleton
     WebSocketClientFactory.__init__(self, *args, **kwargs)
开发者ID:PromenadeSoftware,项目名称:Parlay,代码行数:5,代码来源:websocket.py

示例11: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     WebSocketClientFactory.__init__(self, *args, **kwargs)
     self.protocol_instance = None
     self.base_client = None
开发者ID:arduino-org,项目名称:s4t-iotronic,代码行数:6,代码来源:test_autobahn_ws_client.py

示例12: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self, url):
     WebSocketClientFactory.__init__(self, url)
开发者ID:timewarrior,项目名称:twinkle-client,代码行数:4,代码来源:client.py

示例13: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self, url, app):
    WebSocketClientFactory.__init__(self, url)
    self._app = app
    self._proto = None
开发者ID:BanzaiMan,项目名称:AutobahnPython,代码行数:6,代码来源:client.py

示例14: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
 def __init__(self,endpoint,reactor,irc=None):
     self.irc = irc
     self.reactor = reactor
     WebSocketClientFactory.__init__(self, endpoint, debug = False)
开发者ID:F-Chat-IRC,项目名称:fchat-irc,代码行数:6,代码来源:flistprotocolwsirc.py

示例15: __init__

# 需要导入模块: from autobahn.twisted.websocket import WebSocketClientFactory [as 别名]
# 或者: from autobahn.twisted.websocket.WebSocketClientFactory import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        WebSocketClientFactory.__init__(self, *args, **kwargs)

        self.callbacks = {}
        self.register_callbacks()
开发者ID:CptLemming,项目名称:django-socket-server,代码行数:7,代码来源:client.py


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