binance / binance-connector-node

A simple connector to Binance Public API
MIT License
553 stars 160 forks source link

Implement options passing to websocket constructor #157

Open jazarja opened 4 months ago

jazarja commented 4 months ago

Websocket currently does not have built-in support for proxy configurations. Consequently, it's necessary to provide necessary options directly to the WebSocket constructor when establishing a connection.

Example:

import { SocksProxyAgent } from 'socks-proxy-agent';

...

this.wsClient = new WebsocketStream({
            callbacks,
            combinedStreams: true,
            agent: process.env.BINANCE_PROXY ? new SocksProxyAgent(
                process.env.BINANCE_PROXY
            ) : undefined
        });