binance-api-node icon indicating copy to clipboard operation
binance-api-node copied to clipboard

Websocket was closed before the connection was estabilshed with binance-api-node ticker and futuresticker

Open haunt3dd opened this issue 1 year ago • 1 comments

im trying to closed the connection when running some code and activate the connection again but its give me the error "Websocket was closed before the connection was estabilshed"

const currentWebSocketSpot = client2.ws.ticker( symbol.toLowerCase(), (ticker) => { createFunc(onMessage, "spot", symbol)({ data: JSON.stringify(ticker) }); } ); const currentWebSocketFuture = client2.ws.futuresTicker( symbol.toLowerCase(), (ticker) => { createFunc( onMessage, "future", symbol )({ data: JSON.stringify(ticker) }); } ); webSocketsArr.push({ currentWebSocketSpot, currentWebSocketFuture, });

and this is how i stop the websocket
webSocketsArr.forEach((e) => {
          try {
            e.currentWebSocketSpot();
            e.currentWebSocketFuture();
          } catch (err) {
            console.log("err stop ws");
          }
        });

haunt3dd avatar Dec 27 '23 07:12 haunt3dd

Hello, I wanted to check if you were able to resolve the issue you mentioned earlier? I had the same problem.

pxr-mm avatar Aug 31 '24 06:08 pxr-mm