Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
haunt3dd opened this issue Dec 27, 2023 · 0 comments

Comments

@haunt3dd
Copy link

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");
          }
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant