Closed rennokki closed 3 years ago
It seems this is an issue in echo server itself: https://github.com/tlaverdure/laravel-echo-server/issues/547
Actually, the issue is not regarding the "Bad handshake", somehow Echo refuses to re-subscribe on reconnection, especially listening to this event: https://github.com/laravel/echo/blob/v1.10.0/src/connector/socketio-connector.ts#L26-L30
Hmm, I'll re-open this but will try to look into this when I have time for it. Appreciating any help however.
It seems like the following bit of code added in socketio-connector.ts
under on('reconnect', ...)
handler seems to unsubscribe the user from all channels upon reconnection:
this.socket.on('disconnect', (reason) => {
Object.values(this.channels).forEach((channel) => {
channel.unsubscribe();
});
});
Somehow, something queues the unsubscribes for the reconnection. Also, the on('reconnect', ...)
is not read by any means.
@rennokki hmm that's odd. Appreciating you looking into this. I'm not too familiar with this part here so I also don't know where the queueing would come from.
We've decided we won't be investing time anymore into Socket.io since we don't maintain the laravel-echo-server package. Instead we recommend to use something like https://github.com/beyondcode/laravel-websockets. Sorry for this and thank you for understanding.
Description:
Running on Socket.IO v3, if the server drops connection while the client still tries to reconnect, Echo does not reconnect to the previously connected channels.
I am aware there is PR https://github.com/laravel/echo/issues/290 that aims at Socket.IO v3, but I watched for v2 features that changed in v3 that this package uses, and found none: https://socket.io/docs/v3/migrating-from-2-x-to-3-0
Steps To Reproduce:
private-team.1
channel on reconnection.The private channel code is: