Add event bus for live UI updates
Introduces a system for broadcasting real-time events to the web UI. This enables features like automatic page reloads when case data changes in the background, improving the user experience by keeping the UI synchronized with the backend. Key components: - `events` module: Contains the `CaseEventKind` enum, `CaseEvent` struct, and `EventSender` type for managing the broadcast channel. - SSE endpoint (`/web/events`): Streams events to connected browsers. - Client-side JavaScript: Listens for events and triggers debounced page reloads. - Integration points: Workers and route handlers now emit events when relevant state changes occur.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
mod bulk;
|
||||
mod case_actions;
|
||||
mod debug;
|
||||
mod events;
|
||||
mod health;
|
||||
mod login;
|
||||
mod magic;
|
||||
@@ -54,4 +55,5 @@ pub fn api_router() -> Router<AppState> {
|
||||
"/web/audio/{user}/{case_id}/{filename}",
|
||||
get(web::handle_audio),
|
||||
)
|
||||
.route("/web/events", get(events::handle_events))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user