UI interaction
Event sourcing is eventually consistent, but users expect immediate feedback and near-real-time updates. This page defines how ION’s UIs interact with the event-sourced backend: a CQRS read/write split, a BFF with a hot-entity Sidecar, SignalR for scoped push, and a shared SignalR connection owned by the shell in the micro-frontend architecture.
Components
| Component | Responsibility |
|---|---|
| Portal / MFE (frontend) | CQRS client: reads and writes through BFF APIs; holds one SignalR connection for entity-update notifications; joins and leaves SignalR groups. |
| BFF | Handles both read and write paths. Reads entity lists from the operational API and entity detail from the Sidecar. Validates and forwards write commands. |
| BFF Sidecar | Separate function app that caches hot entities (entities recently opened or updated by a user). Keeps its cache current from Change Feed and notifies SignalR. Redis with LRU/TTL eviction. |
| SignalR Notification Hub | Maintains one connection per user session; creates and manages groups; pushes scoped notifications. |
| Event Store | Validates commands and publishes processing status — including command-failed and command-denied facts. |
Read flow
- Lists always go to the operational API — they may carry filters that need to query across entities, and the backend should not cache large entity sets.
- Detail goes to the Sidecar. On a cache miss the Sidecar reads the operational API, caches the entity, and treats it as hot.
- The UI queries once at the start of a session, caches locally, and applies SignalR updates thereafter.
Write flow
- The UI dispatches the command through a BFF CRUD API and optimistically reflects the change locally (spinner, “Assigning…”).
- APIM enforces authN/Z and rate limits; the BFF validates the payload, publishes the command, and returns 202 Accepted.
- The event store validates business invariants and either appends the event or emits a command-failed / command-denied fact.
- The Sidecar consumes the event, updates its cache, and notifies the hub.
- SignalR pushes the result: success to the entity group, failure only to the initiating user. On failure the UI reverts the optimistic change and offers a retry.
SignalR groups
The frontend joins groups so it only receives relevant events. Naming conventions:
| Group | Convention | Example | Joined when |
|---|---|---|---|
| Dashboard | {Portal}-Dashboard-Group | DefenderWorkbench-Dashboard-Group | On the entity-list page — receives list-impacting events (created, assigned, unassigned). |
| Entity | {Entity}-{EntityId}-Group | Ticket-123-Group | On the entity detail page or on submit — receives updates for that entity (now a hot entity). |
| Customer / tenant | customer-short + tenant scoped | — | For customer-wide notifications. |
The session is keyed by user id / email. Keep separate frontend models for the dashboard/list page and the entity-detail page so notification payloads and processing stay optimized. Group membership is always established by backend APIs after an authorization check — the frontend never grants itself a group.
Micro-frontend shared connection
In the MFE architecture the shell owns a single SignalR connection for the authenticated session; MFEs do not each open their own. This avoids exhausting connection quotas, but the shell must not become a single point of failure, so its role is strictly a network-lifecycle orchestrator.
Shell: msal.js auth → Shell SignalR BFF negotiate → SignalR client token → one WebSocket
Shell shares the connection through the @fe-ws/signalr singleton (useSignalR, useHubEvent)
MFE registers its own subscriptions via its own BFF REST, for example:
POST /api/subscriptions/investigation/{id}
The BFF authorizes, then asks the Shell SignalR BFF to add the user to {entity_name}-{entity_id}
| Owner | Responsibilities |
|---|---|
| Shell | User authentication, SignalR negotiation, connection and reconnection, sharing the connection state. Not resource authorization, business subscriptions, or message routing. |
| MFE | Reading the connection state, registering hub handlers and business subscriptions through its BFF, and re-registering after reconnect. |
Resiliency rules:
- The shell shares only connection state; it never invokes MFE methods or routes payloads.
- On a new connection ID, MFEs catch up missed data over HTTP/REST and re-register subscriptions.
- If the connection stays down, an MFE falls back to HTTP polling. This directive is not implemented yet; see the real-time gaps.
- An MFE unregisters its hub handlers on unmount (
useHubEventdoes this). - Resource authorization is always performed by backend APIs; SignalR groups stay backend-controlled.
Service SKU
The design calls for a SignalR SKU that supports availability zones and autoscaling. The deployed SKU, unit count, and scaling verdict against the 6,000 concurrent-connection envelope are tracked in the capacity model.