Module: Weft::Router::Streaming

Included in:
Weft::Router
Defined in:
lib/weft/router/streaming.rb

Overview

SSE streaming slice of the Router. Handles /component_path/<stream_suffix> requests (stream_suffix defaults to "_stream") for components declaring pushes every:, opening a long-lived connection that emits formatted event:/data: frames on the declared cadence.

Push failures route through the component's recovers chain (component targets only — see Errors#render_push_recovery) and count against an attempts budget; when it runs out, the CLOSE_EVENT frame tells the client to stop reconnecting and the connection closes.

Depends on Router internals: build_component, render_push_companions, render_push_recovery, pass, content_type, headers, stream.

Constant Summary collapse

CLOSE_EVENT =

SSE event name that tells htmx-ext-sse to close the EventSource and stop reconnecting; every pushing component's wrapper names it in its sse-close attribute (Component#apply_push_attrs).

"weft:close"