def connect(self):
self.ended = True
self.hadCtrl = False
self.reconnectTime = time()
if self.timeout:
self.timeout.cancel()
ws = WebSocketApp(self.endpoint.replace('https:','wss:') + '/chatapi/v1/chatnow',
on_open = self.authentify,
on_message = self.parse,
on_error = self.error,
on_close = self.close, header={'User-Agent': 'ChatMan/1 (Android) '})
self.timeout = Timer(80, self.ratamioche)
self.timeout.daemon = True
self.timeout.start()
self.ws = ws
ws.run_forever(sslopt=sslopt_ca_certs, ping_timeout=90)
评论列表
文章目录