WorkerSocket

JSON →
library 0.2.3 ·javascript
verified Jun 7, 2026

An API-compatible WebSocket implementation that runs inside a Web Worker, offloading network I/O from the main thread. Current version 0.2.3, released as an ES module only. The library mirrors the standard WebSocket interface (onmessage, onopen, send, close) but executes in a worker context. Key differentiators: zero dependency on the main thread, fallback to Node's 'ws' package when Web Workers are unsupported (e.g., Node.js), and no bundle size increase for browser users. Ideal for libraries or applications that need to maintain a WebSocket connection without blocking the UI.