A lightweight WebSocket library for JavaScript environments, targeting Bare and Node.js. Version 3.0.0 provides both client and server WebSocket functionality with a simple stream-like API. It is actively maintained by Holepunch and offers TypeScript support. Compared to alternatives like ws, bare-ws is optimized for Bare runtime and has minimal dependencies.
npm install bare-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a WebSocket server and client, sending and receiving messages.
Use { port, host, path } instead of URL string.Use .toString() to convert Buffer to string.
Subscribe to 'end' event for connection close.
npm install bare-ws
Use import ws from 'bare-ws' then new ws.Server()
npm install bare-url