Pushing a server-initiated JSON-RPC notification to an account's live
WebSocket connections.
Why the handler context carries it. A notification carries a domain
payload (an offer, a revoked grant) that only the handler holds, so the
handler builds the message and queues the send after its commit
(queue_offer_notification in auth/role_grant_offer_notifications.ts).
perform_action puts the sender on every ActionContext, so no action
factory takes one and none can be wired with the wrong one: an offer
created over HTTP RPC must reach the recipient's sockets on the WebSocket
registry, which a sender bound to any other registry would miss silently.
Why a fan-out. create_app_backend puts one
RealtimeNotificationSender on AppDeps.notification_sender, and
create_app_server adds every WebSocket connection registry it mounts.
The registries are created at mount, after the RPC and WebSocket action
factories run, so a sender read at send time is the only one that reaches
them. A server mounting no WebSocket endpoint holds an empty fan-out, and
its sends reach no one.
Twin of the Rust spine's NotificationSender and NoopNotificationSender;
the Rust backend serves one connection registry on every endpoint, which
the fan-out stands in for.