ViewBlock / binance-api-node

:chart: A complete and heavily tested wrapper with typings for the Binance API.
654 stars 495 forks source link

Reconnecting-websocket options not working? #635

Open dasbts opened 1 year ago

dasbts commented 1 year ago

Hi,

I'm having the same issue as all the closed reconnecting-websocket problems, and in https://github.com/ViewBlock/binance-api-node/issues/621 it was mentioned to pass options. I investigated and could not find any possible way to add options to miniticker. Is this something that can be looked into?

I checked at node_modules/binance-api-node/index.d.ts and (correct me if I'm wrong but) the code as far as I understand it takes a symbol pair, and then you choose where to get the callback to.

miniTicker: (
      pair: string | string[],
      callback: (ticker: MiniTicker) => void,
    ) => ReconnectingWebSocketHandler

If there is some way to add options such as connectionTimeout to the miniticker already that I don't know about?

dasbts commented 6 months ago

Still wondering about this one, tried so many ways. Anyone know? @balthazar previously refered to using connectionTimeout but idk how to pass it in. Had half a year of disconnecting websockets. :(

For some context, I get same issue as this: https://github.com/ViewBlock/binance-api-node/issues/655

I have tried using the clean() approach, so I assign my ws to a variable[symbol] and then try to call variable[symbol]() to close it. I have investigated the index.ts and tried to make something to somehow override/input the options into the ReconnectingWebSocketHandler but really can't figure this out and it's making me mad.

Might make a try and remake the ws functionality this weekend, maybe that's the best approach, some custom library for just the websockets, and this library for the rest.