Bun Websocket Server
Bun-native WebSocket server built on Bun.serve, with pub/sub topics, typed connection data, and tuning options.
- CCM score
- 58 of 100
- skills.sh installs
- 414
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers the connection lifecycle: upgrade during fetch, open, message, drain, ping, pong, and close handlers
- Includes send patterns for text, JSON, binary, and compressed frames, plus attaching typed data to each connection
- Provides topic broadcasting via
subscribe,publish, and server-level publish, with options likemaxPayloadLength,idleTimeout, andperMessageDeflate - Designed for real-time chat, live updates, and authenticated socket servers, with reference files for compression and horizontal scaling
Install
$ npx -y skills add secondsky/claude-skills --skill bun-websocket-server -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Bun WebSocket Server
Bun has built-in WebSocket support integrated with Bun.serve().
Quick Start
const server = Bun.serve({
fetch(req, server) {
// Upgrade to WebSocket
if (server.upgrade(req)) {
return; // Upgraded successfully
}
return new Response("Not a WebSocket request", { status: 400 });
},
websocket: {
open(ws) {
console.log("Client connected");
},
message(ws, message) {
console.log("Received:", message);
ws.send(`Echo: ${message}`);
},
close(ws) {
console.log("Client disconnected");
},
},
});
console.log(`WebSocket server running on ws://localhost:${server.port}`);
WebSocket Handlers
Bun.serve({
fetch(req, server) {
server.upgrade(req);
},
websocket: {
// Client connected
open(ws) {
console.log("New connection");
},
// Message received
message(ws, message) {
// message is string | Buffer
if (typeof message === "string") {
console.log("Text:", message);
} else {
console.log("Binary:", message);
}
},
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, Frontend & UI Code
- First seen
- Jun 3, 2026
Questions
What does the bun-websocket-server skill do?
It teaches an agent how to build WebSocket servers with Bun using the built-in support in Bun.serve(). It covers connection handlers, sending text and binary messages, attaching data to connections, and pub/sub topics for broadcasting.
How do I install the bun-websocket-server skill?
Run npx -y skills add secondsky/claude-skills --skill bun-websocket-server -y inside your project. Once installed, the agent can write Bun WebSocket code that upgrades requests, handles open, message and close events, and publishes to rooms.
Which skills does bun-websocket-server sit alongside in Backend & APIs?
It is listed in the Backend & APIs category, where entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices are also found. This skill focuses specifically on real-time WebSocket communication built on Bun.serve().
Does bun-websocket-server cover authentication and scaling?
Yes, the skill shows how to verify a token before upgrading a connection and how to attach user data to a socket. Its reference notes also cover Redis pub/sub integration and horizontal scaling across multiple server instances.
More from secondsky/claude-skills
All 116- Bun Redis412
- Ml Pipeline Automation412
- Nuxt Core411
- Nuxt Data411
- Bun Ffi409
- Bun Nuxt409
- Bun Jest Migration408
- Bun Macros407
- Multi Ai Consultant407
- Model Deployment405
- Graphql Implementation403
- Jest Generator402
- Thesys Generative Ui393
- Nuxt Studio391
- Maz Ui390
- Woocommerce Code Review389
- Woocommerce Backend Dev388
- Woocommerce Copy Guidelines384
- Woocommerce Dev Cycle384
- Nuxt Seo345
- Tailwind V4 Shadcn8.4K
- Aceternity Ui1.7K
- Vitest Testing1.3K
- Motion1.2K
Similar to Bun Websocket Server
More Backend & APIswebsocket-implementationsecondsky/claude-skills452 installsReal-time WebSocket server and client patterns built on Socket.IO, with Redis scaling for multi-server deployments.
websocket-developmentmindrally/skills888 installsGuidelines for building real-time WebSocket applications with secure connections, scalable patterns, and tested reliability.
websocket-engineerjeffallan/claude-skills7.5K installsBuild real-time WebSocket and Socket.IO systems with auth, Redis scaling, presence, and rooms.
bun-redissecondsky/claude-skills412 installsRedis client patterns for Bun covering ioredis, Upstash, data structures, pub/sub, and caching.
websocket-realtime-builderpatricio0312rev/skills552 installsReal-time features built on Socket.io, covering auth, rooms, and reconnection handling for live chat and push.
real-time-featuresaj-geddes/useful-ai-prompts550 installsReal-time WebSocket, SSE, and long-polling implementation guidance for chat, dashboards, and live notifications.