Bun Websocket Server
Helps with WebSockets, server as part of developing backend services and APIs workflows.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add bun-websocket-server npx -- -y @trustedskills/bun-websocket-server
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"bun-websocket-server": {
"command": "npx",
"args": [
"-y",
"@trustedskills/bun-websocket-server"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill enables AI agents to create and manage WebSocket servers using Bun, a modern JavaScript runtime. It leverages Bun's built-in WebSocket support integrated within Bun.serve(), allowing for real-time bidirectional communication between clients and the server. The skill provides handlers for connection events (open, close), message reception, ping/pong exchanges, and buffer draining.
When to use it
- Building real-time applications like chat rooms or collaborative editors.
- Creating APIs that require persistent connections, such as streaming data feeds.
- Developing backend services needing bidirectional communication with clients.
- Implementing simple echo servers for testing WebSocket functionality.
Key capabilities
- Handles WebSocket connection establishment (
openevent). - Processes incoming messages from clients (
messageevent), supporting both string and binary data. - Sends messages back to connected clients using
ws.send(). - Manages WebSocket disconnections (
closeevent). - Provides handlers for ping/pong events to maintain connection health.
- Includes a buffer drain handler (
drainevent).
Example prompts
- "Create a simple WebSocket server that echoes back any messages it receives."
- "Set up a Bun WebSocket server with handlers for opening and closing connections."
- "Implement a WebSocket endpoint that sends JSON data to clients."
Tips & gotchas
- This skill requires the Bun runtime environment to be installed.
- The
server.upgrade(req)function is crucial for upgrading HTTP requests to WebSockets. - Message handling supports both string and binary data types, requiring appropriate processing within your handlers.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.