-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to set network proxy? #163
Comments
Hi there, The second parameter for both REST clients lets you pass parameters to the HTTP client used in my connectors (Axios): One of the axios configuration parameters is for proxies: This example passes the example from axios into the main REST client: import { MainClient } from 'binance';
const axiosOptions = {
proxy: {
protocol: 'https',
host: '127.0.0.1',
port: 9000,
auth: {
username: 'mikeymike',
password: 'rapunz3l'
}
}
}
const client = new MainClient({ }, axiosOptions); |
Does websocket client support proxy? |
Not at the moment - it simply opens a connection to the ws urls directly: If you're willing to research how to add proxy support to the ws module when it opens a connection, and implement it (ideally avoiding new dependencies as much as possible), I'll gladly review a pull request. If you're worried about doing it alone or just want to generally discuss this, I also recommend joining the node traders engineering community on telegram: https://t.me/nodetraders |
@tiagosiebler |
Sounds good! If you're willing on making the change (in a way that doesn't break existing functionality), I'd gladly review a pull request. It would also be ideal if these modules could be injected somehow, instead of adding them as a dependency (as they do bring other dependencies as well, which increase module size for others using this connector in frontend projects). Perhaps a parameter for the websocket client constructor (or a setter method like Looks like that would work, based on the https proxy agent docs: https://github.com/TooTallNate/node-https-proxy-agent#ws-websocket-connection-example |
Both http proxy and socks proxy repo works. If using socks5 proxy, the proxy addr should be something like |
I noticed the websocket component is using isomorphic-ws which does not support |
@inix could you kindly give some details to instruct how websocket using proxy? |
Hi:
The Binance domains are blocked in some areas, how to set network proxy if using this lib?
Thanks
The text was updated successfully, but these errors were encountered: