binance-exchange/node-binance-api

websocket 400

beamsies opened this issue · 5 comments

I'm trying to open a websocket with the following example from documentation:
binance.websockets.prevDay('BNBBTC', (error, response) => { console.log(response); });

However, I am getting a 400 response from the server. I noticed in Chrome dev tools that the request was "https://" and not "wss://". So, I tested it in Chrome Simple Websocket client. I changed the "https://" to "wss://" and it worked there but I don't know how to fix it in the program.

I think the "https://" protocol is being transformed in the request.js document. Am I doing something wrong?

Websockets currently do not propagate the 'error' event. Fixing

Fixed here thank you for the report

c158f3f

For now error will always be null but at least it matches the documentation

Live in v0.4.4

Thanks for the prompt response. I will try this out in a bit. One question. I'm running my ReactJS app on my browser on local host. Does this interfere with binance API functionality?

Don't think so, as long as you can actually send data to binance. They have CORS enabled