Skip to main content

Module live

Module live 

Source
Expand description

Process-global registry of live device WS senders, so out-of-band producers (the dashboard refresh loop, the ambient rolling-summary) can push a control message to a connected device without holding its socket. Keyed by device_id; the WS handler registers a clone of its outbound mpsc::Sender on connect and removes it on disconnect (review gap #4: the desk e-ink got no content because nothing ever told it to re-poll).

This is the hardware analog of ryu_dashboards::store’s SSE broadcast: the desktop learns of fresh widget data over SSE; a device learns over its RHP WS.

Functions§

is_connected
Whether a device currently has a live socket (so a producer can skip work for offline devices — the device will re-poll on its own cadence anyway).
register
Register a connected device’s outbound sender. Replaces any prior entry (a reconnect supersedes the stale socket).
send
Push one control message to a connected device. Returns true if it was queued (the device is connected and its channel is not full/closed). A closed channel is pruned so it isn’t retried.
unregister
Remove a device’s sender on disconnect. Idempotent.