Habilidades pitfalls-websocket
🔌

pitfalls-websocket

Seguro 🌐 Acesso à rede📁 Acesso ao sistema de arquivos⚙️ Comandos externos

Implement WebSocket servers with best practices

WebSocket implementations often fail silently due to missing heartbeat or reconnection logic. This skill provides verified patterns for robust real-time connections that survive network issues and handle message validation correctly.

Suporta: Claude Codex Code(CC)
📊 69 Adequado
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "pitfalls-websocket". Review my WebSocket server code

Resultado esperado:

  • ✓ Server shares HTTP port correctly
  • ✗ Missing heartbeat - add ping interval every 30 seconds
  • ✗ No reconnection logic for clients
  • ✓ Message parsing includes try-catch for invalid JSON
  • Recommendation: Add ws.isAlive flag and pong handler to detect dead connections

A utilizar "pitfalls-websocket". Add heartbeat to my WebSocket server

Resultado esperado:

  • Added ping-pong heartbeat with 30-second interval
  • Implemented isAlive flag to track connection health
  • Added terminate() for dead connections
  • Included pong handler to reset isAlive on response

Auditoria de Segurança

Seguro
v5 • 1/16/2026

Pure documentation skill containing only TypeScript code examples for educational purposes. No executable code, file system access, network calls, or command execution capabilities. All static findings are false positives caused by the scanner misinterpreting code examples in markdown documentation as executable patterns. The previous audit (skill-report.json) correctly identified this as safe.

2
Arquivos analisados
302
Linhas analisadas
3
achados
5
Total de auditorias

Fatores de risco

Auditado por: claude Ver Histórico de Auditoria →

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
85
Conteúdo
21
Comunidade
100
Segurança
91
Conformidade com especificações

O Que Você Pode Construir

Build production WebSocket server

Create WebSocket server with heartbeat, proper message handling, and connection lifecycle management

Implement resilient client

Build WebSocket client that reconnects automatically after network interruptions

Audit real-time code

Review WebSocket implementation for missing heartbeat, error handling, or reconnection logic

Tente Estes Prompts

Check Server Setup
Review my WebSocket server code. Check if it shares the HTTP port, has heartbeat implemented, and handles client connections correctly.
Add Heartbeat
Add heartbeat ping-pong mechanism to my WebSocket server. Show how to detect dead connections and terminate them gracefully.
Client Reconnect
Implement WebSocket client reconnection with exponential backoff. Include connection state tracking and error logging.
Message Validation
Review my WebSocket message handling. Add proper JSON parsing, type validation, and error responses for invalid messages.

Melhores Práticas

  • Use same port for WebSocket server and HTTP server to simplify deployment
  • Implement heartbeat every 30 seconds to detect stale connections early
  • Reset reconnection attempt counter on successful connection
  • Validate and type all incoming messages before processing

Evitar

  • Skipping heartbeat - leads to ghost connections consuming resources
  • No reconnection logic - clients stay disconnected after network issues
  • Processing raw messages without validation - security risk

Perguntas Frequentes

What tools support this skill?
Works with Claude, Codex, and Claude Code. Uses natural language understanding for code review.
What are the connection timeout limits?
Heartbeat interval defaults to 30 seconds. Maximum reconnection delay is capped at 30 seconds.
Can I integrate with existing WebSocket libraries?
Patterns work with ws, Socket.io, and native WebSocket. Concepts apply to any WebSocket implementation.
Is my WebSocket data stored or logged?
No. This skill only reviews code you share. No data is stored or transmitted.
Why do connections drop unexpectedly?
Common causes: missing heartbeat causing timeout, load balancer idle timeout, network interruption, or server restart.
How does this compare to Socket.io?
Socket.io provides built-in reconnection. This skill helps when building custom WebSocket solutions or migrating from Socket.io.

Detalhes do Desenvolvedor

Estrutura de arquivos

📄 SKILL.md