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
Socket.io - Client 3.0.0+ reconnect event all failed #1432
Comments
I had this issue too; I figured it out!! It's by design: |
@newpanjing hi! What do you mean by "reconnect event all failed" ? As pointed out by @tannerkrewson (thanks!), the Socket instance no longer emits any reconnection events. // no longer emitted
socket.on("reconnect_attempt", () => {});
// but you can listen to the events emitted by the Manager instance (the io attribute)
socket.io.on("reconnect_attempt", () => {}); |
Would it be possible to have a warning message in the console if someone tries to use those events on the socket itself? I think that would be super helpful for people migrating, instead of it silently failing. 😄 |
I too agree this is kind of confusing. I thought I could listen for reconnect directly on the socket and not socket.io. Would be nice if there was a warning if you try to use an unknown event for socket like @tannerkrewson suggested. Looking back at the documentation though, I clearly didn't read. There are multiple stackoverflows that suggest reconnect works directly on the socket object. |
I'm not sure that adding a warning is a good idea, because users can actually use the "reconnect" event. I've added a note in the documentation, to make it clearer: https://socket.io/docs/v3/client-socket-instance/#Events I'm going to close this for now, please reopen if needed. |
Socket.io - Client 3.0.0+ reconnect event all failed.
Switch to version 2.3.1 and it works.
The text was updated successfully, but these errors were encountered: