WebSocket Server and Client in Bun(js)

Dávid Csejtei
JavaScript in Plain English

--

Bun has a new WebSocket implementation. This is orders of magnitude faster than any socket solution available in Node, according to the official documentation.

Socket server in Bun:

// server.js

Bun.serve({
fetch(req, server) {
// upgrade the request to a WebSocket
if (server.upgrade(req)) {
return;
}
return new Response('Upgrade…

--

--