Skip to main content

Real-Time Updates (Mercure SSE)

PSAPLink uses Mercure Server-Sent Events for live dashboard updates. No polling required.

How It Works

  1. On login, the frontend subscribes to a Mercure topic derived from the user's ID
  2. Cloud publishes SSE events to that topic when relevant state changes
  3. The frontend updates the UI immediately

Published Events

EventWhen
Incident createdNew incident dispatched to a company
Notification sentDelivery attempt made
ACK receivedUser acknowledged via any channel
Reply receivedCompany user sent a reply
PSAP ACKPSAP TCO acknowledged a reply
Escalation triggeredTimeout with no ACK

Payload Encryption

SSE payloads for sensitive topics are encrypted before publishing to Mercure.

  • Keys rotate every 30 minutes, derived deterministically from the master encryption key
  • Wire format: enc:<base64(nonce[24] || ciphertext)>
  • Frontend uses libsodium-wrappers to decrypt; keys fetched via GET /api/v1/realtime/subscribe-key
  • Keys auto-refresh 60 seconds before expiry via the useSseKey hook

Configuration

MERCURE_JWT_SECRET=your-shared-secret
MERCURE_URL=http://mercure/.well-known/mercure # internal
MERCURE_PUBLIC_URL=https://psaplink.com/.well-known/mercure