Simple async iterables for websocket client and server connections. Current stable version is 6.1.5, released under the npm package 'it-ws'. Provides async iterable-based (push-based) duplex streams for WebSocket communication, leveraging the 'ws' library on Node.js and native WebSocket API in browsers. Key differentiators: ESM-only, TypeScript types included, supports both client and server (including TLS), integrates with 'it-pipe' for composable streaming. Alternative to raw WebSocket or socket.io for scenarios requiring lightweight, iterable-based streaming.
npm install it-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a WebSocket echo server and client using async iterables with it-ws and it-pipe.
Use import syntax or switch to dynamic import().
Change import { connect } from 'it-ws' to import { connect } from 'it-ws/client'.Explicitly set binary: true/false to avoid surprises.
Always set binary option explicitly: connect(url, { binary: true }) for Buffer/ArrayBuffer.Provide a raw WebSocket object from the native API or the 'ws' library.
Use import { connect } from 'it-ws/client' or import { createServer } from 'it-ws/server'.For 'duplex', import default: import duplex from 'it-ws/duplex'. For 'connect', use named import from 'it-ws/client'.
Switch to dynamic import() or use ESM: 'type': 'module' in package.json.