A zero-dependency promise wrapper for ws-compatible WebSocket objects. Version 1.1.12 provides a minimal, low-fat API that promisifies open, send, recv, ping, and close operations. Works in browser and Node.js environments that support promises. Unlike heavier alternatives like 'ws-wrapper' or 'reconnecting-websocket', this package is deliberately minimal (≈30 lines) with no dependencies, making it ideal for lightweight or embedded use cases. Its release cadence is low; last update was in 2021.
npm install websocket-lowfat-promiseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a promisified WebSocket, open, send, receive, and close.
Wrap recv() with a timeout or listen for 'close' event externally.
Ensure the underlying WebSocket is configured correctly before passing to wspromise.
First create a WebSocket instance, then pass it to new wspromise(ws).
Consider alternatives like 'ws' with manual Promise wrapping or 'async-ws' for actively maintained solutions.
Always await wsp.open() before any other operations.
Use const wspromise = require('websocket-lowfat-promise'); (CJS) or import wspromise from 'websocket-lowfat-promise'; (ESM).Ensure the argument is a ws-compatible WebSocket instance with standard event methods.
Wrap calls in try/catch or use .catch() to handle promise rejections properly.
No dependency data recorded yet.