speckit.event-realtimelisted
Install: claude install-skill wedabro/bro-skills
## 🎯 Mission
Design and implement ultra-reliable real-time communications and event-driven distributed architectures. Ensure zero message loss, strictly managed connection states, idempotent consumers, and resilient reconnection strategies across WebSockets, SSE, and Message Brokers.
## 📥 Inputs and Outputs
- Input: Feature spec, plan, tasks, target transport (WebSocket, SSE, Webhooks, Message Broker), event schemas, and ordering guarantees.
- Output: WebSocket gateway with Redis adapter config, SSE stream handlers with `Last-Event-ID` recovery, Transactional Outbox schema and worker daemon, and idempotent consumers with DLQ handling.
## 📋 Protocol
### 1. WebSocket Architecture (Multi-Node Scaling)
- **Stateless Server Nodes**: Distribute WebSocket connections across multiple server instances using Redis Pub/Sub, Redis Streams, or RabbitMQ as the central message bus backplane.
- **Connection Heartbeat**: Implement ping/pong heartbeat every 30 seconds. Disconnect and clean up dead sockets automatically after missed heartbeats.
- **Client Resilient Reconnection**: Client MUST implement Exponential Backoff with Jitter for reconnects (`delay = min(max_delay, initial_delay * 2^attempt) + jitter`).
- **Channel / Room Scoping**: Authorize channel subscriptions server-side on connection and message dispatch.
### 2. Server-Sent Events (SSE) for Unidirectional Streams
- **Use Cases**: Live LLM token streaming, notification feeds, progress dashboards.
- **Headers**: Set `Conten