realtime
Real-time patterns: SSE with Redis Pub/Sub and heartbeat, Socket.IO with Redis adapter for multi-server, Supabase Realtime CDC, WebSocket reconnection with exponential backoff, choosing SSE vs WebSockets vs polling. Use when building live updates, notifications, collaborative features, real-time ...
SKILL.md
Full skill instructions
Real-Time Patterns
When to use
- Building live notifications, dashboards, or collaborative features
- Choosing between SSE, WebSockets, and polling
- Scaling real-time to multiple server instances
- Implementing reconnection with backoff
- Setting up Supabase Realtime for database changes
Core principles
- SSE for server-to-client — simpler than WebSockets, auto-reconnects, HTTP/2 multiplexed
- WebSockets for bidirectional — when client sends frequent messages (chat, multiplayer)
- Redis Pub/Sub for multi-instance — events published on one server must reach all clients
- Always heartbeat — detect stale connections; proxies and load balancers kill idle connections
- Exponential backoff on reconnect — avoid stampede when server restarts
References available
references/sse-patterns.md— SSE endpoint setup, Redis Pub/Sub integration, heartbeat, client EventSourcereferences/websocket-patterns.md— Socket.IO multi-server with Redis adapter, reconnection backoffreferences/supabase-realtime.md— Supabase Realtime CDC, channel subscriptions, presence
