Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

I replaced ws with 2.5KB of code and deleted 14 dependencies

DEV Community·rabbxdev·25 days ago
#iAkdwQpq
Reading 0:00
15s threshold

npm install ws = 1.2MB. For a WebSocket. I checked node_modules/ws and found 14 dependencies. To send {"type": "ping"} . So I spent a weekend fixing it. Meet @rabbx/ws: 2.5KB gzipped, zero dependencies 6.4KB minified. 2.5KB gzipped. 0 deps. Tree-shakeable. Side-effect free. Same Web Standard API you know: import { RbxSocket } from ' @rabbx/ws ' const ws = new RbxSocket ( ' wss://echo.websocket.org ' ) ws . on ( ' open ' , () => ws . send ( ' hello ' )) ws . on ( ' message ' , e => console . log ( e . data )) Enter fullscreen mode Exit fullscreen mode But it runs everywhere ws can't. The problem with ws in 2026 ws @rabbx/ws Install size 1.2 MB 6.4 KB Gzipped ~300 KB 2.5 KB Dependencies 14 0 Cold start 118ms 8ms Cloudflare Workers ❌ Needs polyfills ✅ Native Bun 🟡 Works ✅ Native Deno ❌ Needs npm: ✅ Native ws was written in 2011. The web moved on. It still ships bufferutil and utf-8-validate native bindings that break edge runtimes. Cloudflare Workers gives you 50ms CPU time.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More