arcanon

Real-Time Events (SSE)

Subscribe to live graph change events via Server-Sent Events.

Overview

Arcanon Hub pushes real-time updates to connected clients via Server-Sent Events (SSE). When a scan is reconciled, the dashboard receives a graph change event and updates the view without a manual refresh.

Connecting

curl -N -H "Authorization: Bearer $TOKEN" \
  "https://api.arcanon.dev/api/v1/events"

Or with an API key via query parameter (for browsers/EventSource):

const es = new EventSource(
  `https://api.arcanon.dev/api/v1/events?token=${apiKey}`
);

es.addEventListener("graph.changed", (event) => {
  const data = JSON.parse(event.data);
  console.log("Graph updated:", data);
});

Event types

EventDescriptionData
graph.changedService graph was modified by a new scan{ org_id, repo_id, scan_id, services_affected }
scan.completedA scan finished reconciliation{ scan_id, status, services_count, connections_count }
drift.detectedNew drift found during reconciliation{ drift_type, service_a, service_b, severity }

Last-Event-ID replay

SSE connections support Last-Event-ID for resuming after disconnection. The hub maintains a replay buffer of the last 1,000 events per subject via NATS JetStream. On reconnect, send the last received event ID:

const es = new EventSource(url);
let lastId = localStorage.getItem("sse-last-id");
// EventSource automatically sends Last-Event-ID header on reconnect

Architecture

Events flow through NATS Core pub/sub for multi-pod fan-out. Each API server pod maintains an in-process SSE registry (per-connection asyncio.Queue). There is no cross-pod coordination — NATS handles delivery to all pods.

On this page