ws_jobs
tit.server.routes.ws_jobs ¶
/ws/jobs — one shared socket multiplexing every job's status plus subscribed jobs' events.
Server -> client: {"type": "job", "job": <JobStatus>} for every job's transition
(unconditional — the jobs rail needs this regardless of what's open); {"type": "event",
"job_id": ..., "event": <Event>} only for jobs the client has subscribed to, in seq order.
Client -> server: {"subscribe": {"<job_id>": <since_seq>}} / {"unsubscribe": [job_id, ...]}.
Follows the exact pattern of tit/server/ws.py (/ws/system): origin check, then auth,
then accept; run_in_threadpool bridges the manager's thread-safe queue.Queue pub/sub
(fed from :class:tit.jobs.manager.JobManager's own background thread) onto this coroutine's
event loop. Each poll uses a short timeout rather than blocking forever so a disconnected
client's forwarder task actually stops instead of leaking a blocked threadpool worker.