pub fn build_sse_response(
reader: InMemoryQueueReader,
keep_alive_interval: Option<Duration>,
channel_capacity: Option<usize>,
jsonrpc_envelope_id: Option<Option<Value>>,
) -> Response<BoxBody<Bytes, !>>Expand description
Builds an SSE streaming response from an event queue reader.
When jsonrpc_envelope_id is Some (JSON-RPC binding), each event is
wrapped in a JSON-RPC 2.0 success response echoing the original request
id per Section 9.4.2: {"jsonrpc":"2.0","id":<request id>,"result":{...}}.
When jsonrpc_envelope_id is None (REST/HTTP binding), each event is
a bare StreamResponse JSON object per Section 11.7 of the spec.
Spawns a background task that:
- Reads events from
readerand serializes them as SSEmessageframes. - Sends periodic keep-alive comments at the specified interval.
The keep-alive ticker is cancelled when the reader is exhausted.