commit
0addc94ed2
@ -48,14 +48,18 @@ class WebsocketClient(object):
|
||||
|
||||
self.proxy_host = None
|
||||
self.proxy_port = None
|
||||
self.ping_interval = 60 # seconds
|
||||
|
||||
# For debugging
|
||||
self._last_sent_text = None
|
||||
self._last_received_text = None
|
||||
|
||||
def init(self, host: str, proxy_host: str = "", proxy_port: int = 0):
|
||||
""""""
|
||||
def init(self, host: str, proxy_host: str = "", proxy_port: int = 0, ping_interval: int = 60):
|
||||
"""
|
||||
:param ping_interval: unit: seconds, type: int
|
||||
"""
|
||||
self.host = host
|
||||
self.ping_interval = ping_interval # seconds
|
||||
|
||||
if proxy_host and proxy_port:
|
||||
self.proxy_host = proxy_host
|
||||
@ -206,7 +210,7 @@ class WebsocketClient(object):
|
||||
et, ev, tb = sys.exc_info()
|
||||
self.on_error(et, ev, tb)
|
||||
self._reconnect()
|
||||
for i in range(60):
|
||||
for i in range(self.ping_interval):
|
||||
if not self._active:
|
||||
break
|
||||
sleep(1)
|
||||
|
Loading…
Reference in New Issue
Block a user