Real time features is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Implement real-time features using WebSockets (Socket.io, ws), Server-Sent Events (SSE), Supabase Realtime, Firebase, or Pusher. Covers presence indicators, live cursors, CRDT-based collaborative editing (Yjs, Automerge), notifications with offline delivery, chat with optimistic rendering, and Redis
Scaling WebSocket connections across multiple server instances
Core principles
Transport matches use case — SSE for server-push feeds and dashboards; Socket.io for rooms, chat, and bidirectional events; managed services (Pusher, Ably) when infra ownership is not worth it
Authenticate before accepting — validate JWT or session cookie in the Socket.io connection middleware; never allow anonymous socket joins to protected rooms
Always clean up subscriptions — every eventBus.on and every socket.join needs a corresponding teardown on disconnect or component unmount
Deltas over full state — emit only what changed; sending full document snapshots on every keystroke kills throughput and battery
Redis backplane for multi-node — a single Socket.io Redis adapter call is all that stands between "works on one dyno" and "works on ten"
Reference Files
references/websockets-sse.md — technology selection table, Socket.io five-step server setup, SSE ReadableStream implementation for Next.js route handlers, scaling with Redis Pub/Sub and sticky sessions
references/presence-collaboration-chat.md — presence heartbeat with Redis sorted sets, Yjs/Automerge CRDT integration with TipTap/Lexical, notifications pipeline (online WebSocket + offline queue), chat message model and cursor-based pagination, common pitfalls
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.