NEW Browse AI tools across categories — updated daily. See what's new →

Websocket Handler

Implements WebSocket handlers with rooms, authentication, and reconnection logic

Version1.0.0
LicenseMIT
Token count~980
UpdatedJun 5, 2026

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/berkcangumusisik/claude-code-practices
Or pick agent:
npx skills add berkcangumusisik/claude-code-practices --agent claude-code
npx skills add berkcangumusisik/claude-code-practices --agent cursor
npx skills add berkcangumusisik/claude-code-practices --agent codex
npx skills add berkcangumusisik/claude-code-practices --agent opencode
npx skills add berkcangumusisik/claude-code-practices --agent github-copilot
npx skills add berkcangumusisik/claude-code-practices --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add berkcangumusisik/claude-code-practices

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/berkcangumusisik/claude-code-practices.git
cp -r claude-code-practices ~/.claude/skills/
How to use: Once installed, ask your agent to "use the Websocket Handler skill" or describe what you want (e.g. "Implements WebSocket handlers with rooms, authentication, and reconnection logic"). Requires Node.js 18+.

Websocket Handler

Implements WebSocket handlers with rooms, authentication, and reconnection logic

---
name: websocket-handler
description: Implements WebSocket handlers with rooms, authentication, and reconnection logic
argument-hint: <feature-description>
user-invocable: true
allowed-tools: Read Glob Edit
effort: medium
---

WebSocket Implementation

Feature: $ARGUMENTS

  1. Detect WebSocket library:
cat package.json | grep -E '"socket.io"|"ws"|"@fastify/websocket"|"hono.*ws"|"partykit"'
  1. Generate server-side handler:
// Socket.io example
io.on('connection', (socket) => {
  // Auth check
  const userId = socket.handshake.auth.token
  if (!isValidToken(userId)) {
    socket.disconnect()
    return
  }

  // Room management
  socket.join(`user:${userId}`)

  socket.on('message', async (data) => {
    // Validate input
    // Handle event
    // Broadcast to relevant room
    io.to(`room:${data.roomId}`).emit('message', response)
  })

  socket.on('disconnect', () => {
    // Cleanup
  })
})
  1. Generate client-side hook with:
  • Automatic reconnection with exponential backoff
  • Connection state management
  • Cleanup on unmount
  • TypeScript event typing
  1. Add error handling for:
  • Auth failures
  • Network drops
  • Server restarts
  1. Include a message type registry to keep events typed end-to-end.
36:["$","div",null,{"className":"flex flex-wrap items-center gap-3 mb-8","children":[["$","$L39",null,{"skillId":"4d80f84c-fd71-4a78-8989-27350dc95c61","content":"$3a"}],["$","a",null,{"href":"/api/skills/berkcangumusisik-websocket-handler/download","target":"_blank","rel":"noopener noreferrer","className":"inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors","children":[["$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":16,"height":16,"fill":"currentColor","viewBox":"0 0 256 256","transform":"$undefined","children":[false,"$undefined",["$","path",null,{"d":"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"}]]}],"Download Zip"]}],["$","$L3b",null,{"skillId":"4d80f84c-fd71-4a78-8989-27350dc95c61","skillSlug":"berkcangumusisik-websocket-handler","initialVoted":false}]]}] 3d:T4f5,--- name: websocket-handler description: Implements WebSocket handlers with rooms, authentication, and reconnection logic argument-hint: <feature-description> user-invocable: true allowed-tools: Read Glob Edit effort: medium ---

WebSocket Implementation

Feature: $ARGUMENTS

  1. Detect WebSocket library:
cat package.json | grep -E '"socket.io"|"ws"|"@fastify/websocket"|"hono.*ws"|"partykit"'
  1. Generate server-side handler:
// Socket.io example
io.on('connection', (socket) => {
  // Auth check
  const userId = socket.handshake.auth.token
  if (!isValidToken(userId)) {
    socket.disconnect()
    return
  }

  // Room management
  socket.join(`user:${userId}`)

  socket.on('message', async (data) => {
    // Validate input
    // Handle event
    // Broadcast to relevant room
    io.to(`room:${data.roomId}`).emit('message', response)
  })

  socket.on('disconnect', () => {
    // Cleanup
  })
})
  1. Generate client-side hook with:
  • Automatic reconnection with exponential backoff
  • Connection state management
  • Cleanup on unmount
  • TypeScript event typing
  1. Add error handling for:
  • Auth failures
  • Network drops
  • Server restarts
  1. Include a message type registry to keep events typed end-to-end.
3f:[]

---

Source: https://github.com/berkcangumusisik/claude-code-practices
Author: berkcangumusisik
Discovered via: skillsdirectory.com
Genre: data-ai

SKILL.md source

---
name: Websocket Handler
description: Implements WebSocket handlers with rooms, authentication, and reconnection logic
---

# Websocket Handler

Implements WebSocket handlers with rooms, authentication, and reconnection logic

---
name: websocket-handler
description: Implements WebSocket handlers with rooms, authentication, and reconnection logic
argument-hint: <feature-description>
user-invocable: true
allowed-tools: Read Glob Edit
effort: medium
---

## WebSocket Implementation

Feature: **$ARGUMENTS**

1. Detect WebSocket library:
```bash
cat package.json | grep -E '"socket.io"|"ws"|"@fastify/websocket"|"hono.*ws"|"partykit"'
```

2. Generate server-side handler:
```ts
// Socket.io example
io.on('connection', (socket) => {
  // Auth check
  const userId = socket.handshake.auth.token
  if (!isValidToken(userId)) {
    socket.disconnect()
    return
  }

  // Room management
  socket.join(`user:${userId}`)

  socket.on('message', async (data) => {
    // Validate input
    // Handle event
    // Broadcast to relevant room
    io.to(`room:${data.roomId}`).emit('message', response)
  })

  socket.on('disconnect', () => {
    // Cleanup
  })
})
```

3. Generate client-side hook with:
   - Automatic reconnection with exponential backoff
   - Connection state management
   - Cleanup on unmount
   - TypeScript event typing

4. Add error handling for:
   - Auth failures
   - Network drops
   - Server restarts

5. Include a message type registry to keep events typed end-to-end.
36:["$","div",null,{"className":"flex flex-wrap items-center gap-3 mb-8","children":[["$","$L39",null,{"skillId":"4d80f84c-fd71-4a78-8989-27350dc95c61","content":"$3a"}],["$","a",null,{"href":"/api/skills/berkcangumusisik-websocket-handler/download","target":"_blank","rel":"noopener noreferrer","className":"inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors","children":[["$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":16,"height":16,"fill":"currentColor","viewBox":"0 0 256 256","transform":"$undefined","children":[false,"$undefined",["$","path",null,{"d":"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"}]]}],"Download Zip"]}],["$","$L3b",null,{"skillId":"4d80f84c-fd71-4a78-8989-27350dc95c61","skillSlug":"berkcangumusisik-websocket-handler","initialVoted":false}]]}]
3d:T4f5,---
name: websocket-handler
description: Implements WebSocket handlers with rooms, authentication, and reconnection logic
argument-hint: <feature-description>
user-invocable: true
allowed-tools: Read Glob Edit
effort: medium
---

## WebSocket Implementation

Feature: **$ARGUMENTS**

1. Detect WebSocket library:
```bash
cat package.json | grep -E '"socket.io"|"ws"|"@fastify/websocket"|"hono.*ws"|"partykit"'
```

2. Generate server-side handler:
```ts
// Socket.io example
io.on('connection', (socket) => {
  // Auth check
  const userId = socket.handshake.auth.token
  if (!isValidToken(userId)) {
    socket.disconnect()
    return
  }

  // Room management
  socket.join(`user:${userId}`)

  socket.on('message', async (data) => {
    // Validate input
    // Handle event
    // Broadcast to relevant room
    io.to(`room:${data.roomId}`).emit('message', response)
  })

  socket.on('disconnect', () => {
    // Cleanup
  })
})
```

3. Generate client-side hook with:
   - Automatic reconnection with exponential backoff
   - Connection state management
   - Cleanup on unmount
   - TypeScript event typing

4. Add error handling for:
   - Auth failures
   - Network drops
   - Server restarts

5. Include a message type registry to keep events typed end-to-end.
3f:[]


---

**Source**: https://github.com/berkcangumusisik/claude-code-practices
**Author**: berkcangumusisik
**Discovered via**: skillsdirectory.com
**Genre**: data-ai

Related skills 6

running-claude-code-via-litellm-copilot

★ Featured

Use when routing Claude Code through a local LiteLLM proxy to GitHub Copilot, reducing direct Anthropic spend, configuring ANTHROPIC_BASE_URL or ANTHROPIC_MODEL overrides, or troubleshooting Copilot proxy setup failures such as model-not-found, no localhost traffic, or GitHub 401/403 auth errors.

xixu-me 155k
AI & ML

skills-cli

★ Featured

Use when users ask to discover, install, list, check, update, remove, back up, restore, sync, or initialize Agent Skills, mention `bunx skills`, `npx skills`, `skills.sh`, or `skills-lock.json`, ask "find a skill for X", or want help extending agent capabilities with installable skills.

xixu-me 155k
AI & ML

repo-intake-and-plan

★ Featured

Narrow RigorPilot helper for README-first deep learning repo reproduction. Use when the task is specifically to scan a repository, read the README and common project files, extract documented commands, classify inference, evaluation, and training candidates, and return the smallest trustworthy reproduction plan to the main orchestrator. Do not use for environment setup, asset download, command execution, final reporting, paper lookup, or end-to-end orchestration.

lllllllama 127k
AI & ML

image-to-video

★ Featured

Animate any still image on RunComfy — this skill is a smart router that matches the user's intent to the right i2v model in the RunComfy catalog. Picks HappyHorse 1.0 I2V (Arena #1, native audio, identity preservation) for general animations, Wan 2.7 with `audio_url` for custom-voiceover lip-sync, or Seedance 2.0 Pro for multi-modal animation from image + reference video + reference audio. Bundles each model's documented prompting patterns so the caller gets sharper output without burning ite...

agentspace-so 121k
AI & ML

video-edit

★ Featured

Edit existing video on RunComfy — this skill is a smart router that matches the user's intent to the right edit model in the RunComfy catalog. Picks Wan 2.7 Edit-Video (general restyle / background swap / packaging swap, identity + motion preservation), Kling 2.6 Pro Motion Control (transfer precise motion from a reference video to a target character), or Lucy Edit Restyle (lightweight identity-stable restyle / outfit swap). Bundles each model's documented prompting patterns so the skill gets...

agentspace-so 121k
AI & ML

nano-banana-2

★ Featured

Generate images with Google Nano Banana 2 (Gemini-family flash-tier text-to-image) on RunComfy — bundled with the model's documented prompting patterns so the skill gets sharper output than naive prompting against the same model. Documents Nano Banana 2's strengths (rapid iteration, in-image typography rendering, predictable framing, optional web-grounded context), the resolution-tier pricing, the safety-tolerance dial, and when to route to Nano Banana Pro / GPT Image 2 / Flux 2 / Seedream in...

agentspace-so 121k
AI & ML