fix(socket.io-adapter): Add Sid to ExceptSids when client leaves default room #5266
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.
If a client leaves the default room, it won't be excluded from a broadcast. Therefore, during the exclusion process, add it to
exceptSids
if anexceptRoom
is included insids
.The kind of change this PR introduces
Current Behavior
When a client leaves the default room, they are not added to
exceptSids
in thecomputeExceptSids
function during the broadcast process. Thesids
in the default room should be added toexceptSids
, but the default room gets deleted when the client leaves it.New Behavior
If a room is not found in
this.rooms
, it checks whether the room exists inthis.sids
. If it does, the room is added toexceptSids
. This ensures that the client is excluded from the broadcast if they are the sender, even when they are no longer in the default room.Other Information (e.g., related issues)
Related issue: #4524