Expand description
Async Server Sent Event parser and encoder.
§Example
use tide::Request;
#[async_std::main]
async fn main() -> http_types::Result<()> {
let mut app = tide::new();
app.at("/sse").get(|req| async move {
let mut res = tide_compressed_sse::upgrade(req, |_req: Request<()>, sender| async move {
sender.send("message", "foo", None).await?;
Ok(())
});
Ok(res)
});
app.listen("localhost:8080").await?;
Ok(())
}§References
Structs§
- Sender
- An SSE message sender.
Functions§
- upgrade
- Upgrade an existing HTTP connection to an SSE connection.