Skip to content
中文

Transport & streaming ​

Core · Interfaces & runtime guarantees · Back to layer index

SymbolKindPurpose
abortableStreamfunctionRe-yield an async iterable, but reject as soon as signal aborts. The abort reason is propagated unchanged, so callers can tell user cancellation from a provider failure without inspecting messages.
readSsefunctionDecode an SSE response body into events. Framing contract: - A network chunk is not an event. Bytes are buffered until a blank line, because UTF-8 sequences, CRLF pairs and data: lines may all straddle chunk boundaries. - \r\n, \r and \n all terminate a line; a trailing \r at the end of a chunk is held back until the next chunk shows whether an \n follows. - Comment lines (leading :) are discarded; they are used as heartbeats. - The size limit applies per line and per event (1 MiB), not per network read, so many complete events coalesced into one chunk after backpressure remain valid. - Cancellation is checked between lines, so aborting while the consumer is paused stops emitting the remaining buffered events of the same chunk.
SseEventinterfaceOne dispatched SSE event, assembled from all lines up to a blank line.
SseIdleTimeoutErrorclassRaised when no bytes arrive within the configured idle window. A distinct type lets callers treat a silent connection as retryable instead of mixing it with transport or decoding failures.
SseReadOptionstypePer-read configuration; snapshotted when readSse starts.

API reference, usage examples and developer guides.