Markdown view
# Streaming formats and reconnects Event schemas, heartbeats, and reconnect logic for SSE and WebSocket. - Date: Aug 28, 2025 - Reading time: 12 min - Level: Intermediate - Tags: Streaming, Responses, Realtime ## 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.