The End of

The End of "Heavy" WebSockets: Introducing @rabbx/ws

posted 2 min read

The Node.js ecosystem has relied on the ws library for 15 years. It’s reliable, but it was built for a different era—one before Bun, Deno, and Cloudflare Workers redefined the edge.
Enter @rabbx/ws: a zero-dependency, zero-copy WebSocket library designed for 2026. It’s smaller, faster, and truly universal.

Why Move Away from ws?

While the classic ws package is the industry standard, it carries baggage. It’s roughly 80KB with dependencies and relies heavily on Node-specific native hooks.
@rabbx/ws strips away the bloat:

  • Ultra-Lightweight: Only 9KB gzipped with zero dependencies.
  • Web Standard API: No more learning custom event emitters. It uses EventTarget, MessageEvent, and CloseEvent—the same API you use in the browser.
  • Performance First: It’s 3x faster on Bun (by leveraging native Bun.serve) and uses 2.6x less memory than traditional libraries.

    Performance Breakdown

    If you're running high-concurrency applications, the memory savings alone are a game changer.

Metric ws (Node 20) @rabbx/ws (Node 20)
Throughput 380k msg/s 450k msg/s
Max Connections 65k 180k
RAM (10k conns) 1.8GB 680MB

One Import, Every Runtime

The biggest headache in modern web dev is writing code that works on Node but breaks on a Cloudflare Worker. @rabbx/ws solves this by providing specialized helpers for every major runtime while keeping the socket API identical.

1. Bun (The Speed King)
import { createBunServer } from '@rabbx/ws/server';
const { config, server: wss } = createBunServer({ path: '/ws' });
Bun.serve({
  port: 3000,
  fetch: config.fetch,
  websocket: config.websocket
});
wss.addEventListener('connection', ({ detail: { socket } }) => {
  socket.send('Hello from Bun!');
});
2. Node.js (The Reliable Standard)
import { createServer } from 'http';
import { createServer as createWSS } from '@rabbx/ws/server';
const httpServer = createServer().listen(3000);
const wss = createWSS(httpServer, { path: '/ws' });
wss.addEventListener('connection', ({ detail: { socket } }) => {
  socket.addEventListener('message', (e) => socket.send(e.data));
});

Should You Switch?

Use @rabbx/ws if:

  • You are building cross-platform tools.
  • You are running on Bun or Edge functions (Deno/Workers).
  • You need to maximize connections per GB of RAM.
  • You prefer the standard Web API over proprietary emitters.
    Stick with ws if:
  • You require permessage-deflate (compression) immediately (support for this is coming to @rabbx/ws soon in RFC 7692).

    Get Started

    Ready to lighten your stack? Installation is a one-liner:

"Pick your poison"

npm i @rabbx/ws
bun add @rabbx/ws
pnpm add @rabbx/ws

Check out the GitHub Repository to see the full documentation and benchmarks.
https://github.com/rabbxdev/ws

More Posts

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelskiverified - Apr 23

Sovereign Intelligence: The Complete 25,000 Word Blueprint (Download)

Pocket Portfolioverified - Apr 1

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

The End of Data Export: Why the Cloud is a Compliance Trap

Pocket Portfolioverified - Apr 6

Merancang Backend Bisnis ISP: API Pelanggan, Paket Internet, Invoice, dan Tiket Support

Masbadar - Mar 13
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
3 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!