Skip to main content

parse_sse_line

Function parse_sse_line 

Source
pub fn parse_sse_line(line: &str) -> Option<StreamEvent>
Expand description

Parse a raw SSE line pair into a StreamEvent.

Anthropic’s SSE format uses event: <type> and data: <json> lines. This function expects the JSON data: line content (after stripping the data: prefix). The event: line is used by the HTTP client to identify the event type, but the JSON payload itself is self-describing via the "type" field.

Returns None for empty lines, comments, or unparseable data.