pub fn parse_sse(body: &[u8]) -> Vec<SseEvent>Expand description
Parses a whole event-stream body into its events, in order.
Lines end in \r\n, \n or \r; a blank line dispatches the event
being built, unless it has no data (which the spec discards); a line
starting with : is a comment; field:value loses one space after the
colon; a line without a colon is a field with an empty value; unknown
fields and an id containing NUL are ignored. A final event without
its blank line is not dispatched — a browser would not have seen it
either. Linear in the input, one pass, no recursion.
One deliberate difference from a browser, for the sake of assertions:
id and retry describe the event whose lines carried them, rather
than the stream-wide last-event-id and reconnection delay a client
keeps.