Parse an SSE byte stream into events. Follows the WHATWG event-stream rules:
comments (:-prefixed) are ignored, data lines accumulate (joined by \n),
a blank line dispatches the buffered event, and a final block with no trailing
blank line is dropped as incomplete (so a partially-transferred page is never
surfaced).
The in-progress line plus accumulated data lines for a single event are
bounded by maxFrameBytes; a stream that exceeds it (no line terminator, or
an unbounded run of data: lines before a blank line) throws
FeedStreamParseError rather than growing memory without limit — the
JSON feed path enforces the same fail-closed posture via its body-size cap.
Parsing is O(n) regardless of how the bytes are chunked: each decoded chunk is
scanned once, and an un-terminated line is held as a list of fragments joined
only when it completes — never re-scanning or re-flattening a growing buffer.
Parse an SSE byte stream into events. Follows the WHATWG event-stream rules: comments (
:-prefixed) are ignored,datalines accumulate (joined by\n), a blank line dispatches the buffered event, and a final block with no trailing blank line is dropped as incomplete (so a partially-transferred page is never surfaced).The in-progress line plus accumulated
datalines for a single event are bounded bymaxFrameBytes; a stream that exceeds it (no line terminator, or an unbounded run ofdata:lines before a blank line) throws FeedStreamParseError rather than growing memory without limit — the JSON feed path enforces the same fail-closed posture via its body-size cap.Parsing is O(n) regardless of how the bytes are chunked: each decoded chunk is scanned once, and an un-terminated line is held as a list of fragments joined only when it completes — never re-scanning or re-flattening a growing buffer.