Skip to main content

send_streaming

Function send_streaming 

Source
pub fn send_streaming<F, T>(
    factory: F,
    reconnect: ReconnectConfig,
    timeout: Option<Duration>,
) -> Pin<Box<dyn Stream<Item = Result<T, TransportError>> + Send>>
where F: StreamRequestFactory, T: DeserializeOwned + Send + 'static,
Expand description

Send a streaming SSE request and adapt the response into a typed stream.

factory produces a fresh RequestBuilder per attempt; the last_event_id argument is None on the first attempt and contains the most recently observed SSE id: field on every reconnect.

The returned stream yields Result<T, TransportError> items per SSE event. With reconnect.max_attempts == 0 (the default), a transient transport failure ends the stream immediately. With a non-zero limit, the client re-issues the request with a Last-Event-ID header up to max_attempts times, applying exponential backoff between attempts.