Skip to main content

encode

Function encode 

Source
pub fn encode(frame: &Frame) -> String
Expand description

Encode a single frame to its SSE on-wire bytes (as a String, which is always valid UTF-8 here because JSON is UTF-8 and the event name is ASCII).

Output always ends in \n\n — the SSE frame terminator. Callers MUST NOT add their own trailing newline; doing so would emit an empty frame after this one.