A Node.js client for the Binance WebSocket API (WebSocket API, not WebSocket Streams). Version 1.0.11 is the current stable release. It supports both public endpoints (ping, time, exchangeInfo) and authenticated trading endpoints (order, cancel, account info) through the Binance WebSocket API. Unlike REST-based clients, this library uses WebSocket for lower-latency communication. Only spot trading is supported. The library is TypeScript-friendly with bundled type definitions and uses promises/async-await.
npm install binance-websocket-api-nodeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an unauthenticated client, get server time, and fetch exchange info.
Always provide { webSocket: require('ws') } or { webSocket: WebSocket } (if using 'ws' with ESM).Ensure you are using the correct endpoint. The library does not expose endpoint configuration.
Use the userDataStream() method if available, or monitor the library for changes.
Use a different library for futures/margin trading (e.g., binance-api-node).
Ensure you pass the 'ws' module (import WebSocket from 'ws') as the webSocket option.
Run 'npm install ws' or 'yarn add ws' to install the WebSocket dependency.
Verify API key and secret are correct, and ensure your IP is whitelisted in Binance API settings.