From aj-geddes-useful-ai-prompts-4
Implement WebSocket-based real-time communication with connection management, message routing, and horizontal scaling. Covers Node.js/Socket.IO, Python/aiohttp, and Redis.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:websocket-implementationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Build scalable WebSocket systems for real-time communication with proper connection management, message routing, error handling, and horizontal scaling support.
Minimal working example:
const express = require("express");
const http = require("http");
const socketIo = require("socket.io");
const redis = require("redis");
const app = express();
const server = http.createServer(app);
const io = socketIo(server, {
cors: { origin: "*" },
transports: ["websocket", "polling"],
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
reconnectionAttempts: 5,
});
// Redis adapter for horizontal scaling
const redisClient = redis.createClient();
const { createAdapter } = require("@socket.io/redis-adapter");
io.adapter(createAdapter(redisClient, redisClient.duplicate()));
// Connection management
const connectedUsers = new Map();
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Node.js WebSocket Server (Socket.IO) | Node.js WebSocket Server (Socket.IO) |
| Browser WebSocket Client | Browser WebSocket Client |
| Python WebSocket Server (aiohttp) | Python WebSocket Server (aiohttp) |
| Message Types and Protocols | Message Types and Protocols |
| Scaling with Redis | Scaling with Redis |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Builds real-time WebSocket/Socket.IO systems with authentication, room management, pub/sub, and horizontal scaling via Redis adapter.
Builds real-time communication systems with WebSockets and Socket.IO, including bidirectional messaging, horizontal scaling with Redis, presence tracking, and room management.
Builds real-time bidirectional communication systems with WebSockets or Socket.IO, including authentication, rooms, Redis horizontal scaling, presence tracking, and monitoring.