Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Websocket Implementation

  • 600 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

websocket-implementation is an agent skill that provides copy-paste WebSocket and Socket.IO client and server patterns with reconnect, auth handshakes, offline queues, and Redis scaling for developers shipping live SaaS

About

websocket-implementation is an agent skill from aj-geddes/useful-ai-prompts for engineers adding real-time chat, notifications, dashboards, or collaborative editing. It bundles five reference guides covering a Node.js Socket.IO server, browser WebSocket client, Python aiohttp server, message-type protocols, and Redis horizontal scaling with @socket.io/redis-adapter. The quick-start server configures reconnection with reconnectionAttempts set to 5, reconnectionDelay 1000 ms, and Redis adapter wiring for multi-node deployments. Browser client examples track reconnectAttempts, messageQueue buffering while offline, and isAuthenticated handshake state. Best-practice checklists cover room management, message acknowledgment, rate limiting, and connection cleanup. Developers reach for websocket-implementation when scaffolding bidirectional transport instead of inventing reconnect and auth edge cases from scratch for each feature, especially in SaaS products that must survive flaky mobile networks and horizontal scale-out. Reference files split server, browser, Python, protocol, and Redis scaling concerns so agents paste only the slice needed.

  • Reusable WebSocketClient class with configurable max reconnect attempts and backoff delay
  • Socket.IO connect/disconnect/error and connect_error listeners with queued flush on reconnect
  • Auth emit flow with success callback and isAuthenticated gate before sensitive events
  • Listener map and on() registration pattern for extensible event routing
  • Message queue processing when the socket comes back online

Websocket Implementation by the numbers

  • 600 all-time installs (skills.sh)
  • Ranked #656 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill websocket-implementation

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs600
repo stars305
Security audit2 / 3 scanners passed
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you implement production WebSocket reconnect logic?

Give your coding agent copy-paste WebSocket and Socket.IO client patterns with reconnect, auth handshakes, and offline message queues for live SaaS features.

Who is it for?

Full-stack developers adding resilient real-time messaging to SaaS apps with Socket.IO, auth handshakes, and Redis-backed scaling.

Skip if: Projects that only need occasional REST polling or teams standardized on a managed pub/sub service without custom socket code.

When should I use this skill?

A developer asks for WebSocket, Socket.IO, live notifications, chat transport, or Redis-scaled socket clusters.

What you get

Socket.IO server and browser client modules, Redis adapter scaling setup, and message routing protocol references

  • Socket.IO server module
  • Browser client with reconnect queue
  • Redis adapter scaling config

By the numbers

  • Includes 5 reference implementation guides in the references/ directory
  • Default Socket.IO client/server examples set reconnectionAttempts to 5

Files

SKILL.mdMarkdownGitHub ↗

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:

GuideContents
Node.js WebSocket Server (Socket.IO)Node.js WebSocket Server (Socket.IO)
Browser WebSocket ClientBrowser WebSocket Client
Python WebSocket Server (aiohttp)Python WebSocket Server (aiohttp)
Message Types and ProtocolsMessage Types and Protocols
Scaling with RedisScaling 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

Related skills

How it compares

Use websocket-implementation for self-hosted Socket.IO patterns; prefer managed realtime services when ops wants zero socket infrastructure.

FAQ

What stacks does websocket-implementation cover?

websocket-implementation includes five reference guides for a Node.js Socket.IO server, browser WebSocket client, Python aiohttp server, message protocols, and Redis scaling with @socket.io/redis-adapter.

How does websocket-implementation handle disconnects?

websocket-implementation patterns default to 5 reconnectionAttempts, configurable reconnectDelay, an offline messageQueue while disconnected, and isAuthenticated tracking so clients replay queued messages after a successful auth handshake.

Is Websocket Implementation safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIsbackendintegrationsfrontend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.