All guides

Streaming formats and reconnects

Event schemas, heartbeats, and reconnect logic for SSE and WebSocket.

Intermediate12 min readAug 28, 2025
StreamingResponsesRealtime
Key takeaways
  • Document event schemas with versioning.
  • Use heartbeats to detect drops quickly.
  • Resume sessions with replay tokens.

Define event schemas

Publish a versioned event schema and enforce it on both client and server.

Heartbeat and timeout

Send heartbeat events on a fixed interval to detect disconnects.

Reconnect strategy

Use session IDs and replay tokens to resume streams without duplication.