websocket-integration
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Integrates WebSocket real-time communication into a web application. Use when implementing live features like chat, notifications, collaborative editing, or live dashboards.
In this repository58 other files it gives its agents.
- agent-chain-designerSkill
- api-wrapper-builderSkill
- embeddings-builderSkill
- evaluation-harnessSkill
- fine-tuning-preparerSkill
- llm-router-builderSkill
- ml-model-trainerSkill
- model-benchmarkerSkill
- prompt-engineerSkill
- rag-pipeline-builderSkill
- synthetic-data-generatorSkill
- vector-db-integratorSkill
- csv-processorSkill
- database-schema-designerSkill
- data-pipeline-builderSkill
- etl-workflow-designerSkill
- json-transformerSkill
- pandas-data-cleanerSkill
- report-generatorSkill
- sql-query-optimizerSkill
- time-series-analyzerSkill
- visualization-generatorSkill
- backup-strategySkill
- ci-cd-optimizerSkill
- docker-compose-generatorSkill
- github-actions-pipelineSkill
- kubernetes-deploymentSkill
- load-balancer-configSkill
- log-aggregator-setupSkill
- monitoring-dashboardSkill
- nginx-config-generatorSkill
- security-hardeningSkill
- ssl-certificate-managerSkill
- terraform-module-builderSkill
- api-security-auditorSkill
- compliance-checkerSkill
- dependency-checkerSkill
- incident-responderSkill
- jwt-security-auditorSkill
- owasp-checkerSkill
- penetration-test-plannerSkill
- secret-detectorSkill
- threat-model-designerSkill
- vulnerability-scannerSkill
- accessibility-auditorSkill
- api-route-builderSkill
- auth-flow-builderSkill
- css-animation-crafterSkill
- form-validatorSkill
- graphql-schema-designerSkill
- html-component-builderSkill
- nextjs-app-scaffoldSkill
- performance-auditorSkill
- pwa-setupSkill
- react-component-generatorSkill
- responsive-layout-systemSkill
- seo-optimizerSkill
- tailwind-design-systemSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 59
Check browser console for clean connection lifecycle.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Provides complete guidance and code for integrating native WebSockets or Socket.io into web apps, including reconnection with exponential backoff, message envelope format, React hook for lifecycle management, server-side setup (Node/ws or Socket.io), error handling, and authentication patterns for real-time features.
When to Use This Skill
- Adding live chat, notifications, presence indicators, collaborative editing, or live data dashboards.
- The user mentions "real-time", "WebSocket", "live updates", "push", or "socket".
Prerequisites
- Backend that can run a WebSocket server (Node.js, Deno, or cloud service like Pusher, Ably, Supabase Realtime).
- Frontend framework (React, vanilla, etc.).
- For production: load balancer that supports WebSocket upgrade (Nginx, ALB, etc.).
Steps
- Choose transport: Native WebSocket (lightweight) vs Socket.io (more features, fallback).
- Define message protocol (JSON envelope):
{ "type": "chat.message", "payload": {...}, "id": "uuid", "timestamp": "..." } - Client implementation:
- Connection, onopen, onmessage, onerror, onclose.
- Reconnection logic with backoff (max 5 attempts, then show "reconnecting" UI).
- Heartbeat / ping-pong for keepalive.
- React hook (
useWebSocket): manages connection, auto-reconnect, typed message handlers. - Server side: auth on connection (JWT in query or subprotocol), room management, broadcast.
- Security: validate all incoming messages, rate limit, authenticate every connection.
- Output: full hook, example chat component, server route, deployment notes.
Examples
Complete useWebSocket.ts hook, a simple chat UI, and a minimal Node + ws server example are provided.
Edge Cases & Error Handling
- Network drops: exponential backoff + user notification.
- Auth expiration: refresh token and reconnect.
- Large messages: chunk or use binary when appropriate.
- Browser tab sleep: handle visibilitychange to pause/reconnect.
Verification
- Open two browser tabs — messages appear in real time.
- Kill the server — client shows reconnecting UI and recovers when server restarts.
- Check browser console for clean connection lifecycle.
- Success: Real-time features work reliably with graceful degradation.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

