Skip to content
Back to skills

Websocket Handler

ASecurity

Implements WebSocket handlers with rooms, authentication, and reconnection logic

  • 10 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
data-aitypescriptbash

Works with

  • cli

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill websocket-handler --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Websocket Handler?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Websocket Handler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-websocket-handler/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-websocket-handler)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.