Skip to content

How can we force a reconnect for testing only #4611

Discussion options

You must be logged in to vote

Hi! You can close the underlying engine:

const socket = io();

socket.on("connect", () => {
  setTimeout(() => {
    if (socket.io.engine) { // might be undefined if the client is not connected
      socket.io.engine.close();
    }
  }, 5000);
});

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by darrachequesne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants