What HxStream Is

Every significant action in Velaris — a case created, a stage transitioned, a step completed, a note added, an SLA breached, a connector invoked — is published as an event to a Valkey pub/sub channel. HxStream subscribes to that channel and forwards events to connected browsers via an SSE connection. No WebSockets, no polling loops, no stale data. The feed is always current.

HxStream is accessible to agents in the Agent Portal (their personal activity feed), to managers in the Manager Portal (team-wide feed with SLA alerting), and to administrators in Studio (full system event feed including connector calls, escalations, and automated transitions). In all cases, events are scoped to the user's access group — a Claims agent cannot see events from the Underwriting queue.

Access group scoping: The SSE endpoint applies access group filtering at the Valkey subscription level, not the display level. Users never receive payloads for cases outside their permitted groups — the server-side filter runs before any data reaches the wire.

Stream Views

HxStream has four named views that filter the event stream by relevance. Views can be combined with additional filters (date range, case type, event type, user).

View Description Typical Users
All Activity Unfiltered feed of all events within the user's access group. Every case creation, transition, step completion, note, assignment change, SLA alert, and connector call appears in real time. High-volume; best for dashboards and operations centers. Managers, Studio admins
My Cases Filtered to events on cases currently assigned to the authenticated user. Agents use this to see what's happening on their own workload without noise from the broader team. Updates appear the moment a colleague leaves a note or a connector call completes. Agents, case workers
SLA Alerts Only sla_warning and sla_breach events. High-signal view for managers monitoring SLA health. Cards in this view are color-coded: amber for warning (approaching threshold), red for breach. Clears automatically when the SLA condition resolves. Managers, team leads
System Events Platform-level events: connector invocations (including success/failure status), automated stage transitions triggered by rules, escalation chain firings, and scheduled jobs. Essential for diagnosing integration issues in near-real-time. Studio admins, developers

Event Types

Every event in the stream carries a type field that identifies the nature of the action. The following event types are defined:

Event Type Trigger Key Data Fields
case_created A new case instance is created (via portal submission or API). case_id, case_type, created_by, access_group
stage_transitioned A case moves from one stage to the next (manually advanced or auto-triggered). case_id, from_stage, to_stage, triggered_by, is_automated
step_completed An agent completes a step (form submitted, decision recorded, connector step auto-completes). case_id, stage_id, step_id, step_type, completed_by
note_added A case note is posted by an agent, manager, or the system. case_id, note_id, author_id, is_internal
assignment_changed The assigned agent for a case is changed (manual reassignment or SLA-driven escalation). case_id, from_user_id, to_user_id, reason, is_escalation
sla_warning A case's SLA timer crosses the warning threshold (configurable, default 75% of duration elapsed). case_id, stage_id, sla_deadline, time_remaining_seconds, escalation_policy
sla_breach A case's SLA deadline is exceeded while still in the monitored stage. case_id, stage_id, sla_deadline, overdue_seconds, breach_action_taken
connector_call Any step that invokes an external connector (Stripe, Onfido, DocuSign, etc.) starts, succeeds, or fails. case_id, step_id, connector_type, status (pending/success/error), latency_ms, error_code
system_event Automated platform actions: escalation chain fired, scheduled job ran, rule-based auto-transition, graph sync completed. event_subtype, source_module, affected_case_ids, details

Filtering the Feed

Beyond the four named views, HxStream supports additional filter parameters that can be combined. Filters are applied server-side — only matching events are forwarded to the browser, reducing bandwidth on high-volume installations.

How HxStream Works Internally

The internal architecture uses Valkey pub/sub as the event bus between the case-service and the SSE endpoint.

  ┌──────────────────────────────────────────────────────────────┐
  │                      case-service  :8200                     │
  │                                                              │
  │  Case action   >   Event serialized   >   Valkey PUBLISH      │
  │  (create,            to JSON                                 │
  │   transition,        payload              channel:           │
  │   step, SLA)                              "velaris.events    │
  │                                            .{access_group}"  │
  └──────────────────────────────────────────────────────────────┘
                                │
                         Valkey  :6379
                         pub/sub channel
                                │
  ┌──────────────────────────────────────────────────────────────┐
  │                  SSE endpoint  :8200                         │
  │            GET /api/v1/stream/events                         │
  │                                                              │
  │  Valkey SUBSCRIBE   >   Access group filter   >   SSE forward │
  │  (per connection)        (JWT-derived)           to browser  │
  └──────────────────────────────────────────────────────────────┘
                                │
                         Browser  :5173
                     (EventSource API)
                     Renders event cards
                     in real time

Each SSE connection subscribes to a velaris.events.{access_group} Valkey channel. When the case-service publishes an event, all connected SSE sessions for that access group receive it simultaneously. The channel naming scheme ensures cross-group isolation at the message bus level — a message published to the claims channel is never received by a session subscribed to the underwriting channel.

SSE API for Developers

The SSE endpoint is a standard GET request that keeps the HTTP connection open and streams text/event-stream data. Use the browser's native EventSource API or any SSE-compatible HTTP client.

Endpoint

Method Endpoint Auth Content-Type
GET /api/v1/stream/events Bearer JWT (header or ?token= query param for EventSource) text/event-stream

Query Parameters

Parameter Type Default Description
view string all One of: all, my_cases, sla_alerts, system_events
case_type string — Filter by case type slug
event_type string — Comma-separated list of event types to include
case_id string — Pin stream to a single case
since ISO 8601 now Replay events from this timestamp before going live

Event Payload Structure

# SSE wire format — each event block:
id: evt_8f3a2c1d
event: stage_transitioned
data: {
  "id":         "evt_8f3a2c1d",
  "type":       "stage_transitioned",
  "case_id":    "CASE-2041",
  "user_id":    "usr_49c7b2",
  "timestamp":  "2026-05-17T09:14:32.441Z",
  "data": {
    "from_stage":    "Document Collection",
    "to_stage":      "Underwriting Review",
    "is_automated":  false,
    "case_type":     "loan_application",
    "access_group":  "underwriting"
  }
}

JavaScript EventSource Example

// Connect to HxStream via the native EventSource API
const token = localStorage.getItem('velaris_token');
const url = `http://localhost:8200/api/v1/stream/events?view=sla_alerts&token=${token}`;

const stream = new EventSource(url);

stream.addEventListener('sla_breach', (e) => {
  const event = JSON.parse(e.data);
  console.log(`SLA BREACH: ${event.case_id} — overdue by ${event.data.overdue_seconds}s`);
  showBreachAlert(event);
});

stream.addEventListener('sla_warning', (e) => {
  const event = JSON.parse(e.data);
  showWarningBanner(event.case_id, event.data.time_remaining_seconds);
});

stream.onerror = () => {
  // EventSource auto-reconnects on error — no manual retry needed
  console.warn('HxStream connection lost — browser will retry');
};

cURL — Tail the Live Feed

# Stream all events for the current user's access group
curl -N http://localhost:8200/api/v1/stream/events \
  -H "Authorization: Bearer <JWT_TOKEN>" \
  -H "Accept: text/event-stream"

# Stream only SLA alerts for Loan Application cases
curl -N \
  "http://localhost:8200/api/v1/stream/events?view=sla_alerts&case_type=loan_application" \
  -H "Authorization: Bearer <JWT_TOKEN>"

Exporting Activity History

HxStream supports CSV export of the event history for a selected time range and filter set. Exports are triggered from the HxStream UI in Studio or the Manager Portal by clicking Export CSV. All timestamps in the export use ISO 8601 UTC format (2026-05-17T09:14:32.441Z) for unambiguous parsing in external tools.

The export includes: event ID, event type, case ID, case type, user ID, user name, access group, timestamp, and a JSON-encoded data column with type-specific fields. Large exports (over 100,000 rows) are queued as background jobs and delivered via a download link to the requesting user's email.

Studio Location

HxStream is accessible at Studio > HxStream. The Studio view shows the full system-wide feed (all access groups) and includes the System Events view for diagnosing connector failures and automated transitions. The same filter panel available in the Agent/Manager portals is present here, plus a JSON payload inspector that shows the raw event data for any selected event.

Browser tab visibility: SSE connections are paused by most browsers when the tab is backgrounded. The EventSource API will automatically reconnect when the tab comes back to focus. Events generated during the disconnected period are not replayed unless a since timestamp is passed on reconnect. The Velaris frontend handles this automatically for in-app stream views.