Proxy module is needed when you a in a country wehere web is blocked
Proxy module is needed,especially the ws proxy.Now this is my proxy for http:
const Binance =require("node-binance-api");
const binance = new Binance().options({
proxy:{
host:"127.0.0.1",
port:"49751"
},
APIKEY: '````',
APISECRET: '````'
});
But i dont know how to deal with the ws proxy for websocket?
hi @jzyzxx
How could you deal with proxy with future feature?
_binance = new BinanceApi().options({
proxy:{
host:"p.webshare.io",
port:"80",
auth: "userName:password"
},
'APIKEY': apiKey,
'APISECRET': apiSecret,
'test': true,
useServerTime: true
});
The error return tunneling socket could not be established, statusCode=407.
Am I config correctly?
hi @jzyzxx How could you deal with proxy with
futurefeature?_binance = new BinanceApi().options({ proxy:{ host:"p.webshare.io", port:"80", auth: "userName:password" }, 'APIKEY': apiKey, 'APISECRET': apiSecret, 'test': true, useServerTime: true });The error return
tunneling socket could not be established, statusCode=407. Am I config correctly?
The proxy did not work for ws connectionn,maybe you shoud get tips from the author
I can config successfully in http with username and password.
_binance = new BinanceApi().options({
proxy:{
host:"p.webshare.io",
port:"80",
auth: {
username: "yourUserName",
password: "yourPassword"
},
},
'APIKEY': apiKey,
'APISECRET': apiSecret,
'test': true,
useServerTime: true
});
I can config successfully in http with username and password.
_binance = new BinanceApi().options({ proxy:{ host:"p.webshare.io", port:"80", auth: { username: "yourUserName", password: "yourPassword" }, }, 'APIKEY': apiKey, 'APISECRET': apiSecret, 'test': true, useServerTime: true });
But it dit not work for ws connection,the log indicated that the connection timeout.
I can config successfully in http with username and password.
_binance = new BinanceApi().options({ proxy:{ host:"p.webshare.io", port:"80", auth: { username: "yourUserName", password: "yourPassword" }, }, 'APIKEY': apiKey, 'APISECRET': apiSecret, 'test': true, useServerTime: true });But it dit not work for ws connection,the log indicated that the connection timeout.
There are my logs:
[ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ]
[ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ]
[
'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 31.13.69.160:443'
]
[ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ]
[ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ]
[
'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 111.243.214.169:443'
]
[ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ]
[ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ]
I can config successfully in http with username and password.
_binance = new BinanceApi().options({ proxy:{ host:"p.webshare.io", port:"80", auth: { username: "yourUserName", password: "yourPassword" }, }, 'APIKEY': apiKey, 'APISECRET': apiSecret, 'test': true, useServerTime: true });But it dit not work for ws connection,the log indicated that the connection timeout.
There are my logs:
[ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ] [ 'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 31.13.69.160:443' ] [ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ] [ 'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 111.243.214.169:443' ] [ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ]
bump, i have same problem
I can config successfully in http with username and password.
_binance = new BinanceApi().options({ proxy:{ host:"p.webshare.io", port:"80", auth: { username: "yourUserName", password: "yourPassword" }, }, 'APIKEY': apiKey, 'APISECRET': apiSecret, 'test': true, useServerTime: true });But it dit not work for ws connection,the log indicated that the connection timeout.
There are my logs:
[ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ] [ 'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 31.13.69.160:443' ] [ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ] [ 'Futures WebSocket error: btcusdt@miniTicker (ETIMEDOUT) connect ETIMEDOUT 111.243.214.169:443' ] [ 'Futures WebSocket closed: btcusdt@miniTicker (1006)' ] [ 'Futures WebSocket reconnecting: btcusdt@miniTicker...' ]bump, i have same problem
I met the same problem too
seems there is no way to use proxy option in websocket connection, only process.env.https_proxy and process.env.socks_proxy are accepted.
https://github.com/jaggedsoft/node-binance-api/blob/950d773a5f2c3a61c6e29b53e3af57594921a239/node-binance-api.js#L681-L701
can't use custom proxyAgent either.
import Binance from 'node-binance-api';
import tunnel from "tunnel";
const proxy = tunnel.httpsOverHttp({
proxy: {
host: 'localhost',
port: 8080,
proxyAuth: "",
},
});
// doesn't work
const binance = new Binance().options({
proxy: proxy,
});