websocket-hub-patterns
✓Verified·Scanned 2/19/2026
Horizontally-scalable WebSocket hub pattern with lazy Redis subscriptions, connection registry, and graceful shutdown. Use when building real-time WebSocket servers that scale across multiple instances. Triggers on WebSocket hub, WebSocket scaling, connection registry, Redis WebSocket, real-time gateway, horizontal scaling.
from clawhub.ai·v02c4e40·8.8 KB·0 installs
Scanned from 1.0.0 at 02c4e40 · Transparency log ↗
$ vett add clawhub.ai/wpank/websocket-hub-patterns
WebSocket Hub Patterns
Production patterns for horizontally-scalable WebSocket connections with Redis-backed coordination. Includes lazy subscriptions, connection registry, and graceful shutdown.
What's Inside
- Hub structure with local state and Redis coordination
- Hub main loop for connection register/unregister/broadcast
- Lazy Redis subscriptions (subscribe only when first local client joins)
- Redis message forwarding to local WebSocket connections
- Connection write pump with ping/pong and batch draining
- Connection registry for horizontal scaling across instances
- Graceful shutdown with proper cleanup
When to Use
- Real-time bidirectional communication
- Chat applications, collaborative editing
- Live dashboards with client interactions
- Need horizontal scaling across multiple gateway instances
Installation
npx add https://github.com/wpank/ai/tree/main/skills/realtime/websocket-hub-patterns
OpenClaw / Moltbot / Clawbot
npx clawhub@latest install websocket-hub-patterns
Manual Installation
Cursor (per-project)
From your project root:
mkdir -p .cursor/skills
cp -r ~/.ai-skills/skills/realtime/websocket-hub-patterns .cursor/skills/websocket-hub-patterns
Cursor (global)
mkdir -p ~/.cursor/skills
cp -r ~/.ai-skills/skills/realtime/websocket-hub-patterns ~/.cursor/skills/websocket-hub-patterns
Claude Code (per-project)
From your project root:
mkdir -p .claude/skills
cp -r ~/.ai-skills/skills/realtime/websocket-hub-patterns .claude/skills/websocket-hub-patterns
Claude Code (global)
mkdir -p ~/.claude/skills
cp -r ~/.ai-skills/skills/realtime/websocket-hub-patterns ~/.claude/skills/websocket-hub-patterns
Related Skills
- dual-stream-architecture — Event publishing with Kafka + Redis
- resilient-connections — Connection resilience and retry logic
Part of the Realtime skill category.