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

@@ -4,7 +4,6 @@ use picoserve::{
response::{self, IntoResponse},
};
use serde::Deserialize;
use crate::{
store::{Name, hex_string_to_tally_id},
webserver::{app::AppState, sse::IDEvents},
@@ -40,3 +39,7 @@ pub async fn add_mapping(
let tally_id = hex_string_to_tally_id(&data.id).unwrap();
store.mapping.add_mapping(tally_id, data.name);
}
pub async fn get_idevent(State(state): State<AppState>) -> impl IntoResponse{
response::EventStream(IDEvents(state.chan.subscriber().unwrap()))
}