Debian Codegraph @

jellyfin_apiclient_python/keepalive.py

raw symbols SCIP
1 import threading
2
3 class KeepAlive(threading.Thread):
4 def __init__(self, timeout, ws):
5 self.halt = threading.Event()
6 self.timeout = timeout
7 self.ws = ws
8
9 threading.Thread.__init__(self)
10
11 def stop(self):
12 self.halt.set()
13 self.join()
14
15 def run(self):
16 while not self.halt.is_set():
17 if self.halt.wait(self.timeout/2):
18 break
19 else:
20 self.ws.send("KeepAlive")