Binance.ws works on localhost but not on production
awf1337
HOBBYOP

2 years ago

.ws work normally on localhost but on productions it just don't work , I neither get an error or something, idk how to debug this

export class BinanceGatewayService implements OnModuleInit {
public binanceClient: any;

constructor(private eventEmitter: EventEmitter2) {
this.binanceClient = Binance();
}

onModuleInit() {

=====> at this line it stop without errors <===
this.binanceClient.ws.candles(Env().binancesymbol, '1m', (candle: any) => { this.eventEmitter.emit( EmitEnum.BINANCECANDLE_1M,
candleFormatterGateway(candle),
);
console.log('\x1b[36m%s', 'Candle price: ', Number(candle?.close));
});
}

4 Replies

2 years ago

It's wildly known that binance blocks the IPs in use by GCP.


awf1337
HOBBYOP

2 years ago

I didn't know it, any work around ? I need an advice, thanks for your answer


2 years ago

You would need to use an in-code proxy.


awf1337
HOBBYOP

2 years ago

thanks a lot


Loading...