implemented SSE

This commit is contained in:
2025-10-08 01:44:32 +02:00
parent aa91d69f0b
commit 9dd2f88cbc
5 changed files with 22 additions and 15 deletions

View File

@@ -3,15 +3,17 @@ use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex};
use picoserve::{AppWithStateBuilder, routing::get};
use crate::{
TallyChannel, UsedStore,
webserver::{
api::{add_mapping, get_mapping},
api::{add_mapping, get_idevent, get_mapping},
assets::Assets,
}, UsedStore,
},
};
#[derive(Clone)]
pub struct AppState {
pub store: Rc<Mutex<CriticalSectionRawMutex, UsedStore>>,
pub chan: &'static TallyChannel,
}
pub struct AppProps;
@@ -23,9 +25,6 @@ impl AppWithStateBuilder for AppProps {
fn build_app(self) -> picoserve::Router<Self::PathRouter, AppState> {
picoserve::Router::from_service(Assets)
.route("/api/mapping", get(get_mapping).post(add_mapping))
// .route(
// "/api/idevent",
// get(move || response::EventStream(Events(self.chan))),
// )
.route("/api/idevent", get(get_idevent))
}
}