Fix presence:leaving not firing on disconnect due to socket.rooms Set change#7
Open
Oha-you wants to merge 1 commit into
Open
Fix presence:leaving not firing on disconnect due to socket.rooms Set change#7Oha-you wants to merge 1 commit into
Oha-you wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey there!
Thanks for creating and maintaining this fork. I found it very useful even in 2026. I was able to run it with the latest versions of Socket.IO and Laravel Echo without issues.
Specifically:
While testing, I ran into two small issues that required fixes. This pull request addresses the first one.
Clients remained in presence channels even after closing their browsers. This appears to be caused by a breaking change introduced in Socket.IO v3, where
socket.roomswas changed from an object to aSet. As a result, thepresence:leavingevent was not being triggered correctly.While it's possible to work around this on the client side using a
beforeunloadevent listener and callingwindow.Echo.leave, this approach is not fully reliable. For example, it does not handle cases where the browser process is terminated manually (e.g., via Task Manager).This patch ensures that disconnects are handled properly on the server side, restoring correct presence behavior.