Skip to main content

Module pulse_transport

Module pulse_transport 

Source
Expand description

Pulse transport — process-wide broadcast channel for pulse.publish events.

The 0.1 pulse.publish(topic, payload) binding routes through this module when the Poet snapshot is attached to the live daemon graph. Subscribers (e.g. an SSE endpoint, WebSocket relay, or collaborative sync layer) receive a PulseEvent for every published pulse.

Design mirrors crate::daemon_graph: a OnceLock<broadcast::Sender> so the channel is lazily initialised on first use and shared across all callers in the process. The channel capacity is bounded (64) to avoid unbounded memory growth if no subscriber is draining.

Structs§

PulseEvent
A single pulse event emitted by pulse.publish.

Functions§

publish
Publish a pulse event to all subscribers. Returns the sequence number assigned to this event, or 0 if there are no subscribers (the event is still recorded in the sequence counter for monotonicity).
pulse_seq
Current monotonic pulse sequence counter (for diagnostics / UI display).
subscribe
Subscribe to the pulse event stream. Each subscriber gets its own broadcast::Receiver; slow subscribers may miss events if they lag behind by more than PULSE_CHANNEL_CAPACITY.