Crate sse_stream

Source
Expand description

§SSE Stream

Crates.io Version Release status docs.rs

A SSE decoder for Http body

const SSE_BODY: &str =
r#"
retry: 1000
event: userconnect
data: {"username": "bobby", "time": "02:33:48"}

data: Here's a system message of some kind that will get used
data: to accomplish some task.
"#;

let body = Full::<Bytes>::from(SSE_BODY);
let mut sse_body = SseStream::new(body);
async {
    while let Some(sse) = sse_body.next().await {
        println!("{:?}", sse.unwrap());
    }
};

Structs§

Sse
SseStream

Enums§

Error