| Crates.io | actix-sse |
| lib.rs | actix-sse |
| version | 0.1.0 |
| created_at | 2025-07-24 21:41:42.877366+00 |
| updated_at | 2025-07-24 21:41:42.877366+00 |
| description | Actix-web SSE implementation |
| homepage | |
| repository | https://github.com/caido/actix-sse |
| max_upload_size | |
| id | 1766944 |
| size | 55,200 |
SSE implementation for Actix, extracted from actix-web-lab with minimal dependencies.
use std::{convert::Infallible, time::Duration};
#[get("/from-stream")]
async fn from_stream() -> impl Responder {
let event_stream = futures_util::stream::iter([Ok::<_, Infallible>(actix_sse::Event::Data(
actix_sse::Data::new("foo"),
))]);
actix_sse::Sse::from_stream(event_stream).with_keep_alive(Duration::from_secs(5))
}
This should mostly be a drop-in replacement for the sse module, but we did remove a few convenience methods.
Data::from_json: Serialize in the caller and use Data::newData::set_id: Use Data::idSse::from_receiver: Use Sse::from_stream(tokio_stream::wrappers::ReceiverStream::new(rx))