Sponsor Suno AI Music arrow_forward
Slash Command

Build Websocket Server

Build WebSocket servers for real-time bidirectional communication

Type
Slash Command
GitHub stars
2.8k
License
MIT
Repo last updated
Sep 27, 2026

What Build Websocket Server is

Build Websocket Server is a slash command published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”

A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.

Build Websocket Server gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.

How to install Build Websocket Server

Claude Code

  1. Download build-websocket-server.md from the repository.
  2. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
  3. Run it by typing / followed by its name.

Claude Cowork

  1. Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
  2. In Customize → Skills, click +, then upload the ZIP.
  3. Run it from any task with / and the skill name.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/api-development/websocket-server-builder/commands/build-websocket-server.md, shared under the repository's MIT license. Read the full file on GitHub.

Automatically generate production-ready WebSocket servers with Socket.IO or native WebSocket implementations featuring room management, authentication, broadcasting, presence tracking, and resilient connection handling for real-time applications.

When to Use This Command

Use /build-websocket-server when you need to:

  • Build real-time chat applications or messaging systems
  • Implement live collaboration features (Google Docs-style)
  • Create real-time dashboards with live data updates
  • Build multiplayer game servers
  • Stream live data feeds (stock prices, sports scores)
  • Implement real-time notifications and alerts

DON'T use this when:

  • Simple request-response patterns suffice (use REST)
  • Unidirectional server-to-client updates only (consider SSE)
  • Very high throughput binary streaming (consider WebRTC)
  • Message ordering is critical (consider message queues)

Design Decisions

This command implements Socket.IO as the primary approach because:

  • Automatic fallback to long-polling for compatibility
  • Built-in room and namespace management
  • Automatic reconnection with exponential backoff
  • Binary data support with automatic serialization
  • Event acknowledgments and timeouts
  • Extensive middleware ecosystem

Alternative considered: Native WebSocket (ws)

  • Lower overhead and better performance
  • No automatic fallbacks
  • Manual implementation of features
  • Recommended for simple, high-performance needs

Alternative considered: Server-Sent Events (SSE)

  • Simpler for unidirectional communication
  • Works over HTTP/2
  • No bidirectional support
  • Recommended for news feeds, notifications

Prerequisites

Before running this command:

  1. Choose Socket.IO vs native WebSocket
  2. Design event/message protocol
  3. Plan authentication strategy
  4. Define room/channel structure
  5. Determine scaling approach (Redis adapter for multi-server)

Implementation Process

Step 1: Initialize WebSocket Server

Set up Socket.IO or ws server with proper configuration.

Step 2: Implement Authentication

Add middleware for connection authentication and authorization.

Step 3: Define Event Handlers

Create handlers for all client events and server broadcasts.

Step 4: Add Room Management

Implement room joining, leaving, and broadcasting logic.

Step 5: Configure Resilience

Set up reconnection, heartbeat, and error handling.

Output Format

The command generates:

  • websocket/server.js - Main WebSocket server setup
  • websocket/handlers/ - Event handler modules
  • websocket/middleware/ - Auth and validation middleware
  • websocket/rooms/ - Room management logic
  • websocket/presence/ - User presence tracking
  • websocket/client.js - Client SDK/library
  • config/websocket.json - Server configuration
  • tests/websocket/ - Integration tests

Code Examples

Example 1: Full-Featured Chat Server with Socket.IO

// websocket/server.js - Socket.IO server with all features
const { Server } = require('socket.io');
const { createAdapter } = require('@socket.io/redis-adapter');
const { instrument } = require('@socket.io/admin-ui');
const jwt = require('jsonwebtoken');
const Redis = require('ioredis');
const crypto = require('crypto');

class WebSocketServer {
    constructor(httpServer, config = {}) {
        this.config = {
            cors: {
                origin: config.corsOrigin || ['http://localhost:3000'],
                credentials: true
            },
            pingTimeout: config.pingTimeout || 60000,
            pingInterval: config.pingInterval || 25000,
            transports: config.transports || ['websocket', 'polling'],
…

Example 2: High-Performance Native WebSocket Implementation

// websocket/native-server.js - Pure WebSocket with advanced features
const WebSocket = require('ws');
const http = require('http');
const crypto = require('crypto');
const EventEmitter = require('events');

class NativeWebSocketServer extends EventEmitter {
    constructor(server, options = {}) {
        super();

        this.wss = new WebSocket.Server({
            server,
            perMessageDeflate: options.compression !== false,
            maxPayload: options.maxPayload || 10 * 1024 * 1024, // 10MB
            clientTracking: true,
            ...options
        });
…

Example 3: Client SDK and Testing

// websocket/client.js - Browser/Node.js client
class WebSocketClient {
    constructor(url, options = {}) {
        this.url = url;
        this.options = options;
        this.ws = null;
        this.messageHandlers = new Map();
        this.messageQueue = [];
        this.reconnectAttempts = 0;
        this.maxReconnectAttempts = options.maxReconnectAttempts || 5;
        this.reconnectDelay = options.reconnectDelay || 1000;
        this.isConnected = false;
    }

    connect() {
        return new Promise((resolve, reject) => {
            try {
                this.ws = new WebSocket(this.url);
…

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Build Websocket Server?

Build Websocket Server is a slash command for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Build WebSocket servers for real-time bidirectional communication

How do I install Build Websocket Server in Claude Code?

Download build-websocket-server.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.

Can I use Build Websocket Server in Claude Cowork?

Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.

Is Build Websocket Server safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.