Skip to main content

parse_sse_block

Function parse_sse_block 

Source
pub fn parse_sse_block(block: &str) -> SseFrame
Expand description

Parse a single SSE block (the text between two blank lines) into an SseFrame.

Returns an SseFrame with event = SseEvent::Unknown for empty blocks, keepalives, or unrecognized event types. Never panics. Malformed data: JSON is silently ignored and returns Unknown rather than propagating an error.

SseFrame::id carries the value of the id: line, if present. Callers should track this and send it as Last-Event-ID on reconnect per RFC 8620 §7.3.