本文整理汇总了Python中socketIO_client.SocketIO.has_ended方法的典型用法代码示例。如果您正苦于以下问题:Python SocketIO.has_ended方法的具体用法?Python SocketIO.has_ended怎么用?Python SocketIO.has_ended使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socketIO_client.SocketIO
的用法示例。
在下文中一共展示了SocketIO.has_ended方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EtherpadIO
# 需要导入模块: from socketIO_client import SocketIO [as 别名]
# 或者: from socketIO_client.SocketIO import has_ended [as 别名]
class EtherpadIO(object):
def __init__(self, pad, cb,
host='localhost', path='p/', port='9001', secure=False,
verbose = False,
transports=['xhr-polling', 'websocket'],
**kwarg):
log.debug('EtherpadIO(%s://%s:%s/%s%s")' % ('https' if secure else 'http', host,
port, path, pad))
res = requests.get("%s://%s:%s/%s%s" % ('https' if secure else 'http',
host, port, path, pad))
cookie = res.headers['set-cookie']
self.cookie = dict([(cookie[:cookie.find("=")], cookie[cookie.find("=")+1:])])
self.pad = pad
self.cb = cb
self.host = host
self.path = path
self.port = port
self.secure = secure
self.kwarg = kwarg
self.transports = transports
self.__init()
def __init(self):
self.epad = SocketIO(self.host, self.port,
EtherpadService,
secure=self.secure,
transports=self.transports,
cookies=self.cookie,
padid=self.pad,
cb=self.cb, **self.kwarg)
def wait(self):
reconnect = True
while reconnect:
reconnect = self.epad.wait()
del self.epad
if reconnect:
self.__init()
def has_ended(self):
return self.epad.has_ended()
def stop(self):
self.epad.disconnect()
def pause(self):
self.epad.pause()
def patch_text(self, old, new):
cs = pack(old.diff(new))
if cs:
self.epad.namespace.send_user_changes(old.get_revision(), old.get_apool(), cs)