Module

pages.reactive.stream

Reactive SSE stream that auto-pushes re-rendered blocks.

Functions

reactive_stream 6 EventStream
Create an SSE EventStream that auto-pushes re-rendered blocks. Subscribes to t…
def reactive_stream(bus: ReactiveBus, *, scope: str, index: DependencyIndex, context_builder: Callable[[], dict[str, Any] | Awaitable[dict[str, Any]]], origin: str | None = None, kida_env: Any = None) -> EventStream

Create an SSE EventStream that auto-pushes re-rendered blocks.

Subscribes to theReactiveBusfor the given scope. When a ChangeEventarrives, looks up affected blocks in the DependencyIndex and yields them as Fragmentobjects. The chirp SSE layer handles rendering via the app's kida env.

Parameters
Name Type Description
bus ReactiveBus

The reactive event bus to subscribe to.

scope str

Scope key (e.g., document ID).

index DependencyIndex

Dependency index mapping paths to blocks.

context_builder Callable[[], dict[str, Any] | Awaitable[dict[str, Any]]]

Callable that returns the current context dict (called after each change to get fresh data).

origin str | None

Identity of this connection (e.g., user/session ID). Events whoseorigin matches are skipped — the client that caused the change doesn't need to be notified of it. Nonedisables origin filtering.

Default:None
kida_env Any

Deprecated — rendering is handled by the SSE response layer. Accepted for backwards compatibility.

Default:None
Returns
EventStream