Use ws in the browser over Web Streams.
- No polyfills or dependencies.
- 144KB gzipped.
- Tested with Bun.
pnpm i ws-web
import { WebSocket } from "ws-web";
const ws = new WebSocket("ws://fake.com", [], {
proxyStreams: (readable: ReadableStream, writable: WritableStream) => {
// TLS should be handled by the user. Raw data is exchanged here.
},
})
Only the client is supported.
bun i
bun demo
# Navigate to http://localhost:3000
bun i
bun package