Skip to main content

Module sse_parser

Module sse_parser 

Source
Expand description

Server-Sent Events (SSE) frame parser.

Implements a state machine that processes raw bytes and emits SseFrames. The parser handles:

  • Fragmented TCP delivery (bytes arrive in arbitrary-sized chunks).
  • data: lines concatenated with \n when a single event spans multiple data: lines.
  • Keep-alive comment lines (: keep-alive), silently ignored.
  • event:, id:, and retry: fields.
  • Double-newline event dispatch (\n\n terminates each frame).
  • Configurable maximum event size to prevent unbounded memory growth.

Structs§

SseFrame
A fully-accumulated SSE event frame.
SseParser
Stateful SSE byte-stream parser.

Enums§

SseParseError
Errors that can occur during SSE parsing.