Bun WebSockets
Installation
SKILL.md
WebSockets
Server-side WebSockets in Bun
Bun.serve() supports server-side WebSockets, with on-the-fly compression, TLS support, and a Bun-native publish-subscribe API.
Bun's WebSockets are fast. For a simple chatroom on Linux x64, Bun can handle 7x more requests per second than Node.js + "ws".
| Messages sent per second | Runtime | Clients |
|---|---|---|
| ~700,000 | (Bun.serve) Bun v0.2.1 (x64) |
16 |
| ~100,000 | (ws) Node v18.10.0 (x64) |
16 |
Internally Bun's WebSocket implementation is built on uWebSockets.