websocket-implementation▌
aj-geddes/useful-ai-prompts · updated Apr 8, 2026
Build scalable WebSocket systems for real-time communication with proper connection management, message routing, error handling, and horizontal scaling support.
WebSocket Implementation
Table of Contents
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:
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) | 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 |
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
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★40 reviews- ★★★★★Ganesh Mohane· Dec 28, 2024
We added websocket-implementation from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Diya Rahman· Dec 24, 2024
Solid pick for teams standardizing on skills: websocket-implementation is focused, and the summary matches what you get after install.
- ★★★★★Zaid Flores· Dec 20, 2024
Useful defaults in websocket-implementation — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Chinedu White· Dec 4, 2024
Registry listing for websocket-implementation matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Aditi Kim· Nov 23, 2024
websocket-implementation fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Zaid Garcia· Nov 11, 2024
I recommend websocket-implementation for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Zaid Malhotra· Nov 3, 2024
We added websocket-implementation from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Benjamin Diallo· Oct 22, 2024
Solid pick for teams standardizing on skills: websocket-implementation is focused, and the summary matches what you get after install.
- ★★★★★Tariq Thomas· Oct 14, 2024
websocket-implementation is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Aisha Menon· Oct 2, 2024
websocket-implementation reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 40