
Websocket Development
- 653 installs
- 215 repo stars
- Updated June 9, 2026
- mindrally/skills
websocket-development is a Claude Code skill that encodes secure, scalable WebSocket patterns—including wss:// connections and connection lifecycle management—for developers building real-time application features.
About
websocket-development is a mindrally/skills guide for production WebSocket systems. It stresses step-by-step planning, wss:// encrypted transport, rigorous connection management, and complete implementations without placeholders. Security, scalability, and maintainability are prioritized across establish, heartbeat, reconnect, and teardown flows. Developers reach for websocket-development when adding live dashboards, chat, collaborative editing, or streaming telemetry—not for vanilla REST CRUD. The skill expects agents to deliver end-to-end connection handling code rather than skeletal stubs, making it suited to backend engineers hardening real-time APIs before ship.
- Core principles require step-by-step thinking before writing any code
- Mandates wss:// with SSL/TLS for all production connections
- Enforces heartbeat/ping-pong, exponential backoff reconnection, and proper resource cleanup
- Requires structured JSON messages with type/payload, IDs, and versioning
- Prioritizes security, scalability, and zero-todo implementations
Websocket Development by the numbers
- 653 all-time installs (skills.sh)
- +20 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #570 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mindrally/skills --skill websocket-developmentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 653 |
|---|---|
| repo stars | ★ 215 |
| Last updated | June 9, 2026 |
| Repository | mindrally/skills ↗ |
How do you build secure scalable WebSocket backends?
Get expert guidance on secure, scalable WebSocket implementations for real-time features.
Who is it for?
Backend developers adding real-time features who need opinionated WebSocket security and connection lifecycle patterns.
Skip if: Projects using only HTTP polling or SSE without WebSockets, or front-end CSS work without real-time transport.
When should I use this skill?
The user implements WebSockets, wss:// connections, real-time messaging, or live application features requiring persistent sockets.
What you get
Complete WebSocket server and client handlers with wss:// transport, connection lifecycle code, and scalability guidance.
- WebSocket connection handlers
- Secure wss:// client and server code
- Real-time messaging architecture notes
Files
WebSocket Development
You are an expert in WebSocket development and real-time communication systems. Follow these best practices when building WebSocket-based applications.
Core Principles
- Think through the implementation step-by-step before writing code
- Follow the user's requirements carefully and to the letter
- Prioritize security, scalability, and maintainability throughout
- Leave NO todos, placeholders, or missing pieces in the implementation
Connection Management
Establishing Connections
- Always use the
wss://protocol with SSL/TLS encryption for production environments - This ensures data transmitted over the connection is encrypted and secure from eavesdropping or tampering
- Implement proper handshake validation before accepting connections
- Set appropriate connection timeouts to prevent resource exhaustion
Connection Lifecycle
- Implement heartbeat/ping-pong mechanisms to detect stale connections
- Use reconnection logic with exponential backoff for dropped connections
- Maintain connection state to handle disconnection scenarios gracefully
- Clean up resources properly when connections close
Message Handling
Message Design
- Use structured message formats (JSON with type/payload pattern)
- Include message IDs for request-response correlation
- Implement message versioning for backward compatibility
- Keep message payloads small to reduce latency
Error Handling
- Always include error handling logic for WebSocket connections
- Manage potential disconnections or message failures gracefully
- Implement dead letter handling for unprocessable messages
- Log errors with sufficient context for debugging
Scalability Patterns
Horizontal Scaling
- Use a message broker (Redis Pub/Sub, RabbitMQ) for cross-server communication
- Implement sticky sessions or connection affinity when needed
- Design stateless handlers where possible
- Consider using a dedicated WebSocket gateway service
Performance Optimization
- Buffer messages during brief disconnections
- Implement message batching for high-frequency updates
- Use binary protocols (MessagePack, Protocol Buffers) for bandwidth-sensitive applications
- Monitor connection counts and message throughput
Security Best Practices
Authentication
- Authenticate connections during the handshake phase
- Use token-based authentication (JWT) with proper expiration
- Validate tokens on both connection and periodic intervals
- Implement rate limiting per connection and per user
Authorization
- Validate permissions for each message type/channel
- Implement channel-based access control for pub/sub patterns
- Never trust client-provided data without validation
- Sanitize all incoming message payloads
Framework-Specific Guidelines
Node.js Native WebSocket (v21+)
- Utilize Node.js's built-in WebSocket client for real-time communication to reduce dependencies
- The built-in client simplifies real-time communication and ensures better interoperability
- For servers, use established libraries like
wsor framework-specific solutions
Bun Runtime
- Prefer Bun's native capabilities over third-party alternatives
- Use
Bun.serve()with WebSocket support instead of separate WebSocket libraries - Leverage Bun's built-in stream handling and fetch implementation
Browser Clients
- Implement graceful degradation for older browsers
- Use the standard WebSocket API for broad compatibility
- Handle visibility changes to manage connection state
- Implement offline detection and queuing
Testing Strategies
Unit Testing
- Mock WebSocket connections for isolated testing
- Test message serialization/deserialization independently
- Verify error handling paths
Integration Testing
- Test full connection lifecycle scenarios
- Verify reconnection behavior under various failure modes
- Load test with realistic connection counts and message rates
Monitoring and Observability
- Track connection count metrics
- Monitor message latency and throughput
- Alert on connection error rates
- Log connection lifecycle events for debugging
Common Patterns
Pub/Sub Pattern
- Implement channel subscription management
- Use efficient data structures for subscriber lookup
- Handle subscription cleanup on disconnect
Request/Response Pattern
- Correlate requests and responses with unique IDs
- Implement timeout handling for pending requests
- Consider using acknowledgment messages for reliability
Broadcast Pattern
- Optimize for one-to-many message delivery
- Consider message deduplication strategies
- Implement backpressure for slow consumers
Related skills
FAQ
Does websocket-development require TLS?
websocket-development instructs agents to always use the wss:// protocol for establishing secure WebSocket connections in production, prioritizing encrypted transport alongside scalable connection management.
Can websocket-development leave placeholder code?
websocket-development requires complete implementations with no todos, placeholders, or missing pieces, delivering full connection lifecycle handling for real-time application requirements.