Skip to main content

Module sse

Module sse 

Source
Available on crate feature sse only.
Expand description

Client-side Server-Sent Events.

Conn::into_sse executes a request and interprets the response body as an text/event-stream, yielding a Stream of Events. Unlike into_websocket, this is not a protocol upgrade — an event stream is an ordinary response whose body is read incrementally and parsed line-by-line. It works identically over HTTP/1.x, HTTP/2, and HTTP/3.

This is a single-response stream: it ends when the connection closes. It does not implement the EventSource automatic-reconnection behavior (re-issuing the request with Last-Event-ID and honoring server retry: timing), which only makes sense for idempotent event feeds. To retry a dropped request, drive the whole request through a retrying ClientHandler.

Structs§

Event
A single server-sent event.
EventStream
A Stream of Events decoded from a text/event-stream response body.
SseError
An attempt to open an EventStream via Conn::into_sse failed.

Enums§

SseErrorKind
The kind of error that occurred attempting to open an EventStream.