Skip to content

Realtime (SSE)

Microbase broadcasts record changes over Server-Sent Events (SSE) at /api/realtime.

  1. Open an EventSource to /api/realtime (or /api/realtime?token=<JWT> for authenticated subscriptions).
  2. Receive the initial PB_CONNECT event containing your clientId.
  3. Subscribe to collections or individual records via POST /api/realtime:
Terminal window
curl -X POST http://localhost:3000/api/realtime \
-H "Authorization: Bearer <JWT>" \
-H "Content-Type: application/json" \
-d '{
"clientId": "<CLIENT_ID>",
"subscriptions": ["posts", "posts/RECORD_ID"]
}'
  • Max 20 concurrent SSE connections per IP and 1,000 global connections to protect against connection exhaustion.
  • Every delivered event is evaluated against the subscriber’s collection view_rule.