Statewide Docs

The live event stream

How the MDT and boards get live updates from /api/stream.

/api/stream?c=<community slug> is a server-sent events stream. Each message carries an id, and its data is JSON with id, topic, type, payload and at (an ISO time). You receive only events for topics you may see, so a member never receives another department's private events.

  • When reconnecting, send the last id you saw in a Last-Event-ID header and Statewide replays what you missed, up to 1,000 events from the last 24 hours. If you're further behind, Statewide sends a resync event, and you should reload your data.
  • A keep-alive comes every 15 seconds.
  • Access is re-checked every 5 minutes while the stream is open. Losing access, such as a suspension or removal, ends the stream.