Skip to main content
skill CX Codex

websockets-realtime — Claude Code skill: setup and features

websockets-realtime is a Claude Code skill that guides real-time data setup for chats, live feeds, and collaborative editing.

MIT 172 installs ★ 114 updated 2026-11-10

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add travisjneuman/.claude --skill websockets-realtime -a claude-code
Open on GitHub

What websockets-realtime does

The skill provides architectural patterns and code samples for WebSocket, Server-Sent Events, Long Polling, and WebRTC. It includes a TypeScript client blueprint with reconnect logic that handles exponential backoff.

Specific guides reside in the references/ directory. They cover Node.js implementations with ws and Socket.IO, custom React hooks, message formatting, and cross-server scaling with Redis Pub/Sub.

What it helps with

  • select the right transport between WebSocket, SSE, and WebRTC
  • write WebSocket clients with automatic reconnection logic
  • scale Socket.IO servers using a Redis Pub/Sub adapter
  • apply authentication and rate limiting to real-time connections

Example prompts for the agent

  • Implement a reconnecting WebSocket client in TypeScript
  • Set up a Node.js server using the ws library with authentication
  • Create a React hook to manage Socket.IO event listeners

How to install websockets-realtime

1Skills CLI (Vercel)

npx skills add travisjneuman/.claude --skill websockets-realtime -a claude-code

2Manually: put the files in place

~/.claude/skills/websockets-realtime/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/websockets-realtime/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about websockets-realtime

How to install websockets-realtime in Claude Code?

Run npx skills add travisjneuman/.claude --skill websockets-realtime -a claude-code.

What does websockets-realtime do?

It provides guidance and reference templates for real-time protocols, client reconnection, and server scaling.

What libraries does this skill cover?

The reference guides detail setups using Node.js, ws, Socket.IO, and Redis Pub/Sub.

Source text

SKILL.md · MIT
---
name: websockets-realtime
description: Real-time communication with WebSockets, Server-Sent Events, and related technologies. Use when building chat, live updates, collaborative features, or any real-time functionality.
---

# WebSockets & Real-Time

Comprehensive guide for building real-time applications.

## Real-Time Technologies

### Comparison

| Technology             | Direction               | Use Case                    |
| ---------------------- | ----------------------- | --------------------------- |
| **WebSocket**          | Bidirectional           | Chat, gaming, collaboration |
| **Server-Sent Events** | Server → Client         | Live feeds, notifications   |
| **Long Polling**       | Simulated bidirectional | Fallback, simple updates    |
| **WebRTC**             | Peer-to-peer            | Video calls, file sharing   |

### When to Use What

```
WEBSOCKETS:
✓ Chat applications
✓ Real-time collaboration
✓ Gaming
✓ Financial trading
✓ IoT dashboards
✓ Any bidirectional communication

SERVER-SENT EVENTS (SSE):
✓ Live feeds (news, sports)
✓ Notifications
✓ Progress updates
✓ Server-initiated updates only

LONG POLLING:
✓ Fallback when WebSocket unavailable
✓ Simple, infrequent updates
✓ Behind strict firewalls

WEBRTC:
✓ Video/audio calls
✓ Screen sharing
✓ Peer-to-peer file transfer
```

---

## WebSocket Fundamentals

### How WebSockets Work

```
HTTP Upgrade Handshake:
┌──────┐                      ┌──────┐
│Client│  GET /ws HTTP/1.1    │Server│
│      │  Upgrade: websocket  │      │
│      │ ──────────────────>  │      │
│      │                      │      │
│      │  HTTP/1.1 101        │      │
│      │  Switching Protocols │      │
│      │ <──────────────────  │      │
└──────┘                      └──────┘

After handshake:
┌──────┐                      ┌──────┐
│Client│ <═══════════════════>│Server│
│      │  Full-duplex TCP     │      │
│      │  Binary or text      │      │
└──────┘                      └──────┘
```

### Client Implementation

```typescript
// Basic WebSocket client
const ws = new WebSocket("wss://api.example.com/ws");

ws.onopen = () => {
  console.log("Connected");
  ws.send(JSON.stringify({ type: "subscribe", channel: "updates" }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log("Received:", data);
};

ws.onerror = (error) => {
  console.error("WebSocket error:", error);
};

ws.onclose = (event) => {
  console.log("Disconnected:", event.code, event.reason);
};

// Send message
ws.send(JSON.stringify({ type: "message", content: "Hello!" }));

// Close connection
ws.close(1000, "Normal closure");
```

### Reconnection Logic

```typescript
class ReconnectingWebSocket {
  private ws: WebSocket | null = null;
  private reconnectAttempts = 0;
  private maxReconnectAttempts = 10;
  private reconnectDelay = 1000;

  constructor(private url: string) {
    this.connect();
  }

  private connect() {
    this.ws = new WebSocket(this.url);

    this.ws.onopen = () => {
      console.log("Connected");
      this.reconnectAttempts = 0;
    };

    this.ws.onclose = (event) => {
      if (event.code !== 1000) {
        this.reconnect();
      }
    };

    this.ws.onerror = () => {
      this.ws?.close();
    };
  }

  private reconnect() {
    if (this.reconnectAttempts >= this.maxReconnectAttempts) {
      console.error("Max reconnection attempts reached");
      return;
    }

    this.reconnectAttempts++;
    const delay = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);

    console.log(
      `Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts})`,
    );

    setTimeout(() => this.connect(), delay);
  }

  send(data: unknown) {
    if (this.ws?.readyState === WebSocket.OPEN) {
      this.ws.send(JSON.stringify(data));
    }
  }
}
```

---

## Reference files

Detailed material is in separate files so this overview stays short. Read only the file whose topic matches the task; each one is self-contained. Paths are relative to the folder that holds this `SKILL.md` (in the full toolkit install, `~/.claude/skills/websockets-realtime/`).

| Topic | File | Covers |
| --- | --- | --- |
| Server Implementation (Node.js) | [`references/server-implementation-node-js.md`](references/server-implementation-node-js.md) | ws Library; Socket.IO |
| Server-Sent Events (SSE) | [`references/server-sent-events-sse.md`](references/server-sent-events-sse.md) | Server Implementation; Client Implementation |
| Message Protocols | [`references/message-protocols.md`](references/message-protocols.md) | JSON Message Format; Binary Protocols |
| Scaling WebSockets | [`references/scaling-websockets.md`](references/scaling-websockets.md) | Architecture; Redis Pub/Sub for Cross-Server Messages; Socket.IO with Redis Adapter |
| React Integration | [`references/react-integration.md`](references/react-integration.md) | Custom Hook; Socket.IO Client |
| Security | [`references/security.md`](references/security.md) | Authentication; Rate Limiting |
| Best Practices | [`references/best-practices.md`](references/best-practices.md) | DO:; DON'T: |
| Troubleshooting | [`references/troubleshooting.md`](references/troubleshooting.md) | Common Issues; Debug Logging |

© travisjneuman · MIT · travisjneuman/.claude

Similar skills

All skills for Backend and APIs →

From the same set117

The whole set →
marketing Marketing frameworks for the agent: brand architecture, positioning, research methods, segmentation, personas and channel metrics, ready to fill with your own data. CX Codex +1 181installs generic-fullstack-feature-developer generic-fullstack-feature-developer guides end-to-end feature development across Next.js App Router, NestJS, and Prisma. Use it when adding full-stack slices, updating schemas, or building API routes. CX Codex +1 180installs startup-launch startup-launch — a skill for Claude Code that guides founders from problem discovery to public release. Structures customer interviews and filters product hypotheses before coding starts. CX Codex +1 175installs android-development The android-development Claude Code skill supports Android app development with Kotlin and Jetpack Compose. It activates for work on Material Design or modern Android architecture. CX Codex +1 175installs risk-management Enterprise risk management guidelines for assessing operational, tech, and vendor risks. Helps build heat maps and business continuity frameworks. CX Codex +1 171installs innovation An innovation-management playbook the agent can consult: horizons, portfolio mix, ideation, Stage-Gate, venture capital and IP. Handy when product bets need sorting. CX Codex +1 170installs api-design api-design is a Claude Code skill with guidelines and templates for REST, gRPC, and tRPC APIs; it helps generate OpenAPI schemas and keep route naming consistent. CX Codex +1 170installs generic-static-design-system generic-static-design-system — a design system skill for static sites built purely with HTML, CSS, and vanilla JS. Guides the agent to build lightweight interfaces without Tailwind or build tools. CX Codex +1 168installs

Project sponsors

Companies that keep this analytics open