feat(events): A.4 — emit SnapshotChanged from the watchdog probe
Adds a new variant to the lifecycle event catalogue so the UI can
auto-refresh the channel/client tree without an independent polling
timer on the Dart side. The supervisor's existing 5 s snapshot probe
is the source of truth: it already pulls a full snapshot to keep
the watchdog honest, so we piggyback on it.
* `chanora_core::SessionEvent::SnapshotChanged { channels, clients }`
carries the latest channel and client counts.
* The supervisor compares the probe result to `last_counts` and
fires the event only when the count actually changes. `last_counts`
is reset to `None` on a successful reconnect so the freshly
dialled session re-emits its initial counts.
* `chanora_bridge::api::BridgeEvent::SnapshotChanged` is the
cross-bridge mirror.
* Flutter routes the event through `_onEvent`, which calls
`_onRefresh()` to repopulate the snapshot view.
The probe-driven detection has known limits — pure within-channel
client moves do not change the count and so are not surfaced. That
gap will close when the supervisor tracks a content hash in
addition to the count; the count-only signal is sufficient for the
common "someone joined / someone left" case observed on cn.teamspeak.app.
This commit is contained in:
@@ -211,6 +211,17 @@ sealed class BridgeEvent with _$BridgeEvent {
|
||||
|
||||
/// Audio engine stopped.
|
||||
const factory BridgeEvent.audioStopped() = BridgeEvent_AudioStopped;
|
||||
|
||||
/// Snapshot probe observed a change in channel/client counts.
|
||||
/// UI uses this to drive an auto-refresh without active
|
||||
/// polling.
|
||||
const factory BridgeEvent.snapshotChanged({
|
||||
/// Latest channel count.
|
||||
required int channels,
|
||||
|
||||
/// Latest client count.
|
||||
required int clients,
|
||||
}) = BridgeEvent_SnapshotChanged;
|
||||
}
|
||||
|
||||
/// Coarse OS-reported network state. Mirrors
|
||||
|
||||
Reference in New Issue
Block a user