Framed WebSocket Communication library for Node.js and browser (version 1.2.9, last updated 2023). It wraps WebSocket messages in a frame data structure (fid, rid, type, data) and supports three serialization codecs: JSON, CBOR, and MsgPack. This enables complex data serialization, type annotation, and request/response correlation. The library is lightweight (<5KB), has zero runtime dependencies, and works with standard WebSocket API. It is available as CommonJS only, with no ESM or TypeScript type definitions. Release cadence is low; the last release was in 2023.
npm install websocket-framedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a WebSocketFramed instance, attach message handler, and send/receive frames.
Add a declaration file: declare module 'websocket-framed'; or use @ts-ignore.
Do not rely on the return value for delivery guarantees. Use WebSocket bufferedAmount or wait for 'drain' event if needed.
Attach the wsf 'message' listener before calling wsf.send() or before the WebSocket 'open' event fires.
Install the package manually: npm install cbor msgpack5
Use `const WebSocketFramed = require('websocket-framed');` instead of `import`.npm install cbor
npm install msgpack5
No dependency data recorded yet.