app.api.ws
WebSocket push to dashboards: vehicle.update every tick, alert and what-if events as they happen.
Events come from sync callbacks (alert engine, what-if) through Hub.publish; one task sends them and
the periodic vehicle snapshot, computed once per tick for all clients. A client that can’t take a message
within send_timeout_s is dropped instead of slowing everyone else down; the dashboard reconnects on
its own (frontend/js/api.js) and gets a fresh snapshot.
Classes
|
- class app.api.ws.Hub(*, send_timeout_s: float = 2.0)[исходный код]
Базовые классы:
object- __init__(*, send_timeout_s: float = 2.0) None[исходный код]
- publish(msg: dict) None[исходный код]
- async run(snapshot: Callable[[], dict], tick_s: float = 1.0) None[исходный код]
- async send_all(msg: dict) None[исходный код]
- async app.api.ws.ws(websocket: fastapi.WebSocket) None
Dashboard stream: a snapshot on connect, then
vehicle.update/alert.*/whatif.result.