[][src]Module tide::sse

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

Sender

An SSE message sender.

SseEndpoint

An endpoint that can handle SSE connections.

Functions

endpoint

Create an endpoint that can handle SSE connections.

upgrade

Upgrade an existing HTTP connection to an SSE connection.