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

Report event when listenKeyExpired #569

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Report event when listenKeyExpired #569

wants to merge 2 commits into from

Conversation

clcreuso
Copy link
Contributor

@clcreuso clcreuso commented Feb 1, 2021

The reconnect options (for websocket) is not working for me.

Now i can make my reconnection manualy, like this:

const newSubscribedMessage = async (message) => {
  logger.fatal(`BINANCE_WS_SUBSCRIBED_MESSAGE ${JSON.stringify(message)}`);

  if (message === 'listenKeyExpired') {
    const endpoints = binance.futuresSubscriptions();

    for (const endpoint in endpoints) {
      binance.futuresTerminate(endpoint);
    }

    websocketConnection();
  }
};

function websocketConnection() {
  logger.warn('FUTURE_DATA_STREAM CONNECTION');

  binance.websockets.userFutureData(
    newMarginMessage,
    newAccountMessage,
    newOrderMessage,
    newSubscribedMessage,
  );
}

@clcreuso
Copy link
Contributor Author

clcreuso commented Feb 3, 2021

If you think this is a good feature, tell me. I will do the same for other websockets

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

Successfully merging this pull request may close these issues.

None yet

1 participant