websocket-realtime

websocket-realtime is a skill for Claude Code from medy-gribkov/arcana. It costs 36 tokens per session (1,652 once invoked), scanned A, original, Apache-2.0.

A guide to building real-time connections between clients and servers using WebSockets, server-sent events, or Socket.io.

In plain words
What is it for?
Use it for chat, live updates, multiplayer features, room-based messaging, reconnection, and Redis-backed message sharing.
Why use it?
It helps handle dropped connections, inactive clients, authentication, and scaling across multiple servers.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Good fit Use it for chat, live updates, multiplayer features, room-based messaging, reconnection, and Redis-backed message sharing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/medy-gribkov/arcana/websocket-realtime
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add medy-gribkov/arcana --skill websocket-realtime
Clone the repo
git clone --depth 1 https://github.com/medy-gribkov/arcana

Made for: Claude Code.

Its marketplace also offers this one on its own, as the plugin websocket-realtime/plugin install websocket-realtime after adding the marketplace above.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for websocket-realtime

README.md
[![agentmods](https://agentmods.dev/badge/skills/medy-gribkov/arcana/websocket-realtime/github.svg)](https://agentmods.dev/skills/medy-gribkov/arcana/websocket-realtime)
Your own site
<a href="https://agentmods.dev/skills/medy-gribkov/arcana/websocket-realtime"><img src="https://agentmods.dev/badge/skills/medy-gribkov/arcana/websocket-realtime/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for websocket-realtime

Your own site · 80×15
<a href="https://agentmods.dev/skills/medy-gribkov/arcana/websocket-realtime"><img src="https://agentmods.dev/badge/skills/medy-gribkov/arcana/websocket-realtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,652 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.01652
Opus 5 $0.00018 $0.00826
Sonnet 5 $0.00007 $0.00330
Haiku 4.5 $0.00004 $0.00165

Measured 9d ago against content hash 62201384e969, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

websocket-realtime scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/websocket-realtime/SKILL.md · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WebSocket and Real-Time Communication

Build production-ready WebSocket servers with reconnection, heartbeat, authentication, and horizontal scaling.

WebSocket Server (Node.js ws)

BAD: No connection lifecycle management.

import WebSocket, { WebSocketServer } from 'ws';

const wss = new WebSocketServer({ port: 8080 });

wss.on('connection', (ws) => {
  ws.on('message', (data) => {
    // Broadcast to everyone
    wss.clients.forEach((client) => {
      client.send(data);
    });
  });
});

GOOD: Connection tracking, error handling, graceful shutdown.

import WebSocket, { WebSocketServer } from 'ws';
import http from 'http';

interface Client {
  ws: WebSocket;
  userId: string;
  rooms: Set<string>;
  isAlive: boolean;
}

const server = http.createServer();
const wss = new WebSocketServer({ server });
const clients = new Map<WebSocket, Client>();

wss.on('connection', (ws, req) => {
  const client: Client = {
    ws,
    userId: '', // Set after auth
    rooms: new Set(),
    isAlive: true,
  };
  clients.set(ws, client);

  ws.on('pong', () => {
    client.isAlive = true;
  });

  ws.on('message', (data) => {
    try {
      const msg = JSON.parse(data.toString());
      handleMessage(client, msg);
    } catch (err) {
      ws.send(JSON.stringify({ error: 'Invalid message format' }));
    }
  });

  ws.on('error', (err) => {
    console.error('WebSocket error:', err);
  });

  ws.on('close', () => {
    clients.delete(ws);
  });

  ws.send(JSON.stringify({ type: 'connected' }));
});

// Heartbeat interval
const heartbeat = setInterval(() => {
  wss.clients.forEach((ws) => {
    const client = clients.get(ws);
    if (!client) return;

    if (!client.isAlive) {
      client.rooms.clear();
      clients.delete(ws);
      return ws.terminate();
    }

    client.isAlive = false;
    ws.ping();
  });
}, 30000);

// Graceful shutdown
process.on('SIGTERM', () => {
  clearInterval(heartbeat);
  wss.clients.forEach((ws) => {
    ws.close(1000, 'Server shutting down');
  });
  server.close(() => {
    process.exit(0);
  });
});

server.listen(8080);

Read the full file on GitHub · 304 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 304 lines · 36 tokens per session scan A 62201384e969

Subscribe to this mod's changes

websocket-realtime is a skill published in the GitHub repository medy-gribkov/arcana (1 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 36 tokens to every session and 1,652 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.