feat(events): SSE event bus + browser auto-reconciliation (BUNYIP-145) #176
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!176
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/bunyip-145-sse-event-bus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Introduces a tokio::sync::broadcast-backed in-process EventBus on bunyip-api with per-user and global channels, and a long-lived GET /v1/events SSE endpoint subscribed to it. Six admin handlers (update_user_status, update_user_role, grant_membership, revoke_membership, grant_lifetime_membership, revoke_lifetime_membership) now publish ClaimsChanged or SessionRevoked events alongside the existing rt-revocation from BUNYIP-144, so a Brendon-style lifetime grant or an admin deactivation propagates to the user's browser within milliseconds. The bunyip-web dashboard and admin shells inject a tiny inline EventSource subscriber that opens against bunyip-api with credentials, reloads the page on claims_changed / profile_changed / applications_changed / resync, and redirects to /login on session_revoked. The browser-facing api origin is pinned into the layout module at startup via install_sse_api_origin so the script reaches every authenticated shell without threading config through 45 handler call sites. Keepalive frames every 25 s keep proxies (Cloudflare, Traefik) from killing the stream.
#BUNYIP-145