real-time-communication-patterns
Installation
SKILL.md
Real-Time Communication Patterns
Overview
Real-time communication introduces connection lifecycle complexity, horizontal scaling challenges, and security risks that request/response APIs avoid entirely. A single unbounded connection pool, missing heartbeat, or JWT exposed in a query string can bring down production systems.
When to use: Designing live dashboards, chat, collaborative editing, notifications, streaming APIs, IoT device feeds, or any feature where the server must push data to clients unprompted.
Quick Reference
| Protocol | Direction | Reconnect | Scaling | Best For |
|---|---|---|---|---|
| WebSocket | Full-duplex | Manual | Redis Pub/Sub or sticky sessions | Chat, games, collaborative editing |
| Server-Sent Events (SSE) | Server → client | Auto (EventSource) | Standard HTTP load balancer | Notifications, live feeds, dashboards |
| Long Polling | Server → client | Per-request | Standard HTTP load balancer | Legacy clients, firewall-constrained envs |
| gRPC Streaming | Full-duplex | Manual | L7 load balancer (Envoy) | Microservice-to-microservice real-time |