Module tide::sse[][src]

Expand description

Server-Sent Events (SSE) types.

Errors

Errors originating in the SSE handler will be logged. Errors originating during the encoding of the SSE stream will be handled by the backend engine the way any other IO error is handled.

In the future we may introduce a better mechanism to handle errors that originate outside of regular endpoints.

Examples

use tide::sse;

let mut app = tide::new();
app.at("/sse").get(sse::endpoint(|_req, sender| async move {
    sender.send("fruit", "banana", None).await?;
    sender.send("fruit", "apple", None).await?;
    Ok(())
}));
app.listen("localhost:8080").await?;

Structs

An SSE message sender.

An endpoint that can handle SSE connections.

Functions

Create an endpoint that can handle SSE connections.

Upgrade an existing HTTP connection to an SSE connection.