websocket-implementation · aj-geddes — Claude Code skill: WebSocket servers
A coding skill that walks you through building a WebSocket server: connection management, message routing, and Redis-based scaling.
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a claude-codeWhat websocket-implementation does
The skill covers how to build real-time systems over WebSocket. It ships a quick start on Node.js with express, socket.io and redis, plus reference guides in the references/ directory: a Socket.IO server, a browser client, a Python server on aiohttp, message types and protocols, and scaling with Redis.
The quick start sets reconnection options and wires a Redis adapter for horizontal scaling. Connection management uses a Map; the full implementation lives in the reference guides. You need Node.js and the packages express, socket.io, redis and @socket.io/redis-adapter.
A separate section lists practices: authentication, graceful reconnection, rooms and channels, rate limiting, message acknowledgment. The don't list warns against unbounded message history in memory and arbitrary room creation. If scaling has been a later problem for you, this is a reason to check the architecture before the first release.
What it helps with
- stand up a WebSocket server on Node.js with Socket.IO
- handle client reconnection after a dropped network
- route messages across rooms and channels
- wire a Redis adapter for multiple instances
- add authentication and message rate limiting
Example prompts for the agent
- build a Socket.IO WebSocket server with rooms and a Redis adapter
- add reconnection handling and message acknowledgments
- show me how to scale WebSockets across instances with Redis
How to install websocket-implementation
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a claude-code2Manually: put the files in place
~/.claude/skills/websocket-implementation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/websocket-implementation/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a codex2Manually: put the files in place
.agents/skills/websocket-implementation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a cursor2Manually: put the files in place
.cursor/skills/websocket-implementation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts websocket-implementation2Manually: put the files in place
.github/skills/websocket-implementation/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/websocket-implementationManually: put the files in place
.devin/skills/websocket-implementation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about websocket-implementation
How do I install websocket-implementation in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill websocket-implementation -a claude-code. The skill lands in ~/.claude/skills/websocket-implementation/SKILL.md.
What does websocket-implementation do?
It helps you implement real-time bidirectional communication: connection management, message routing, error handling, and scaling with Redis.
What is this skill used for?
Chat, live notifications, collaborative editing, dashboards, and streaming events to clients.
Source text
SKILL.md · MIT
---
name: websocket-implementation
description: >
Implement real-time bidirectional communication with WebSockets including
connection management, message routing, and scaling. Use when building
real-time features, chat systems, live notifications, or collaborative
applications.
---
# WebSocket Implementation
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Build scalable WebSocket systems for real-time communication with proper connection management, message routing, error handling, and horizontal scaling support.
## When to Use
- Building real-time chat and messaging
- Implementing live notifications
- Creating collaborative editing tools
- Broadcasting live data updates
- Building real-time dashboards
- Streaming events to clients
- Live multiplayer games
## Quick Start
Minimal working example:
```javascript
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)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Node.js WebSocket Server (Socket.IO)](references/nodejs-websocket-server-socketio.md) | Node.js WebSocket Server (Socket.IO) |
| [Browser WebSocket Client](references/browser-websocket-client.md) | Browser WebSocket Client |
| [Python WebSocket Server (aiohttp)](references/python-websocket-server-aiohttp.md) | Python WebSocket Server (aiohttp) |
| [Message Types and Protocols](references/message-types-and-protocols.md) | Message Types and Protocols |
| [Scaling with Redis](references/scaling-with-redis.md) | Scaling with Redis |
## Best Practices
### ✅ DO
- Implement proper authentication
- Handle reconnection gracefully
- Manage rooms/channels effectively
- Persist messages appropriately
- Monitor active connections
- Implement presence features
- Use Redis for scaling
- Add message acknowledgment
- Implement rate limiting
- Handle errors properly
### ❌ DON'T
- Send unencrypted sensitive data
- Keep unlimited message history in memory
- Allow arbitrary room/channel creation
- Forget to clean up disconnected connections
- Send large messages frequently
- Ignore network failures
- Store passwords in messages
- Skip authentication/authorization
- Create unbounded growth of connections
- Ignore scalability from day one
© aj-geddes · MIT · aj-geddes/useful-ai-prompts
Similar skills
Everything for Backend and APIs →websocket-implementation by other authors comes first.