mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2026-05-01 02:59:09 +00:00
implemented SSE
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user