websockets
Skill by 0xBakeer
Guides an AI assistant to build realtime two-way messaging between a browser and a server with WebSockets, using FastAPI or Node ws. Covers the message schema, reconnect, heartbeats, broadcast and testing with a scripted client.
Install websockets
Built from the published package, never by AI.
git clone --depth 1 https://github.com/0xBakeer/TandemLLM /tmp/TandemLLM && mkdir -p ~/.claude/skills && cp -r /tmp/TandemLLM/packages/library/websockets ~/.claude/skills/websocketsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/0xBakeer/TandemLLM /tmp/TandemLLM && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/TandemLLM/packages/library/websockets ~/.gemini/antigravity-cli/skills/websocketsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
WebSockets is an agent skill for building realtime two-way messaging between a browser and a server. It works with FastAPI or Node ws. It sets one JSON message shape with a type and a data field, and the server ignores unknown types with a logged warning. It also covers heartbeats, broadcasting and reconnecting after a drop.
The server keeps a set of open connections and broadcasts by sending to all clients concurrently with a timeout, so one slow client does not block the rest. The browser side wraps the socket in a small class that queues messages until the socket is open and retries with backoff of 1, 2, 4 and 8 seconds, up to 30. The skill asks for testing with a scripted client such as websocat or Python websockets, and suggests server-sent events for one-way updates. It is aimed at developers building live features.
Written from the project's SKILL.md and checked against it.
What it can do
- Message schemaSets one JSON shape with a type and data field, and ignores unknown types with a logged warning.
- BroadcastSends to all open connections concurrently with a timeout and drops dead clients.
- Heartbeat rulesPings clients every 30 seconds and closes a client that misses two pings.
- Browser reconnectWraps the socket in a class that queues messages and reconnects with backoff, then re-sends its subscription.
- Scripted client testingChecks message delivery between two clients and connection counts through a state endpoint.
What you need
- Python with FastAPI, or Node.js with the ws package
- A browser for the client side
- A scripted client tool such as websocat, Python websockets, or Node ws
Try asking
- Add a WebSocket chat endpoint to my FastAPI app with broadcast.
- Wrap my browser WebSocket in a class that reconnects with backoff.
- Test my WebSocket server with two scripted clients and show the messages.
Good to know
- The source suggests server-sent events instead when the client only receives updates.
- Messages are queued only until the socket opens, and the reference code does not include the heartbeat logic.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: packages/library/websockets/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to websockets
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
websockets: common questions
Does this work with FastAPI and Node.js?
The source covers FastAPI and Node ws, with reference code for both. It describes the browser client as a small class that wraps the socket.
How does reconnect work?
The browser client retries with backoff of 1, 2, 4 and 8 seconds, up to 30, and re-sends its subscription after reconnecting. The source notes that a dev server reload otherwise leaves every client disconnected.
How do I test a WebSocket server without a browser?
The source recommends a scripted client such as websocat, Python websockets, or Node ws. It suggests checking that a message from one client reaches another.
How do I install websockets?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is websockets free?
The code is published under the AGPL-3.0 licence. The service it connects to may have its own pricing.
Is websockets safe to use?
It scores 63 of 100. Grades: maintenance A, licence C, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to websockets?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
