Skip to main content

Module broadcast

Module broadcast 

Source
Expand description

Process-wide broadcast channel for the canonical log stream.

The gateway installs a [tokio::sync::broadcast::Sender<Value>] here at startup; every event passing through crate::record_event is fanned out to that channel so SSE clients (and any other in-process subscriber) see the live stream.

Lives in this crate, not in zeroclaw-runtime, so the dependency graph stays clean: zeroclaw-api → zeroclaw-config → zeroclaw-log → everything else.

Functions§

clear_broadcast_hook
Remove the broadcast sender (tests, orderly shutdown).
current_broadcast_hook
Read the current broadcast sender, if any.
set_broadcast_hook
Install a process-wide broadcast sender. Calling again replaces the previous one (the old sender will be dropped — its Receivers will see RecvError::Closed on their next read).
subscribe
Subscribe to the broadcast stream. Returns None when no sender has been installed yet (e.g. when running tests that never wired the gateway). The receiver yields every event emitted via crate::record_event after the subscribe call.

Type Aliases§

LogBroadcastSender
Type alias for the canonical log broadcast sender.