Expand description
Server Sent Events (SSE)
§Example
use dhttp::reqres::res;
struct MyEvents;
impl HttpSse for MyEvents {
async fn next(&mut self) -> Option<HttpSseEvent> {
Some(HttpSseEvent::new("hello world"))
}
}
struct MyService;
impl HttpService for MyService {
async fn request(&self, _route: &str, _req: &HttpRequest, _body: &mut dyn HttpRead) -> HttpResult {
Ok(res::sse(MyEvents))
}
}Structs§
Traits§
- HttpSse
- SSE stream