Isomorphic WebSocket wrapper that uses the ws library on Node.js and the native WebSocket API in browsers. Version 5.0.0 is the latest stable release, published July 2021. Requires ws as a peer dependency. The API matches the browser WebSocket standard but has notable differences from ws's Node interface (e.g., no Server class, no options constructor argument). Provides TypeScript type declarations. Lightweight and straightforward, but developers must test cross-environment behavior. Active maintenance with infrequent releases.
npm install isomorphic-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an isomorphic WebSocket connection to a test server, sends timestamps and measures roundtrip time.
Only use the address and protocols arguments; do not pass options like { perMessageDeflate } when running in browser.Use ws.Server only in Node.js environment; conditionally import server code.
Test your code in both Node and browsers to ensure feature compatibility.
Upgrade Node to 10 or later, or continue using 4.x if stuck on older versions.
Run 'npm install ws' alongside isomorphic-ws.
Use 'import WebSocket from "isomorphic-ws"' or 'const WebSocket = require("isomorphic-ws")'.Ensure ws is installed as a dependency: 'npm install ws'.
No dependency data recorded yet.