realtime
3 modules
realtime/sse_auth_guard.ts
SSE auth guard and convenience factory for audit log SSE.
create_sse_auth_guard bridges audit events to
SubscriberRegistry.close_by_identity(), closing SSE streams when a subscriber's access is revoked (role revocation or session invalidation).create_audit_log_sse is a convenience factory that combines the registry, guard, and broadcaster — making the secure path the easy path for consumers.
realtime/sse.ts
SSE (Server-Sent Events) streaming utilities for Hono.
Provides generic helpers for creating SSE response streams and a notification type aligned with JSON-RPC 2.0.
realtime/subscriber_registry.ts
Generic subscriber registry for broadcasting to SSE clients.
Supports channel-based filtering — subscribers connect with optional channel filters, and broadcasts reach only matching subscribers. Optional identity keys enable force-closing subscribers by identity (e.g., close all streams for a specific account when their permissions change).