The only thing this doesnt handle is when a client goes into offline due to a transient link failure but it comes back online. We want to avoid updating the DB every time a pong is RX'd.. Perhaps we do a seocndary corss checks with offline hosts?
10 lines
256 B
Python
10 lines
256 B
Python
# websocket_server/shared_state.py
|
|
|
|
import threading
|
|
|
|
connected_workers = {}
|
|
worker_lock = threading.Lock()
|
|
connected_sids = set()
|
|
connected_sids_lock = threading.Lock()
|
|
ping_tracker = {} # Maps worker_id → {"ping_id": str, "sent_time": float}
|