本文整理汇总了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"
示例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()
示例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)
示例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
示例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
示例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()
示例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)
示例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'])
示例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"
示例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)
示例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
示例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)
示例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
示例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)
示例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()