How the SSE decoder turns bytes into events
Spec-compliant stream parsing with boundary guard protection
Pause
Step
Reset
\r Guard ON
\r Guard OFF
STAGE 1: THE WIRE
Network chunks arriving in sequence
CHUNK 1
data: {"text":"hel
CHUNK 2
then lo"}
\r
CHUNK 3
\n\r\n
STAGE 2: THE BUFFER
Accumulator & split-boundary protection
INTERNAL BYTE BUFFER
""
TAIL CHARACTER STATUS:
CLEAR (No pending \r)
GUARD CALLOUT
STATUS: GUARD ENABLED
Ready to receive network chunks.
STAGE 3: SCAN & DISPATCH
EOL Line parsing & Spec Accumulators
LINE SCANNER
Splits on \r\n | \r | \n
ACCUMULATOR: DATA
[empty]
ACCUMULATOR: EVENT
"message" (default)
ACCUMULATOR: ID
[empty]
EMITTED SSE EVENT
Waiting for empty line...
bytes