Repository navigation
fix(relay): notify and stop replaced party connections - #384
Merged
Merged
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.
When the same player joined a party room from another connection, the relay removed the old socket from the room without notifying it. A still-running Rose kept receiving ping responses, retained stale members and believed it could publish skins, although the room ignored its updates. The old socket could also send another join and replace the newer connection.
Send a
replacedmessage before removing the old connection, and ignore subsequent joins from removed sockets. Preserve the relay's existing avoidance of server-initiated closes. Rose treats replacement as final: clear stale members, close its socket without sending leave, stop publishing and stop automatic reconnection. Explicit resume can establish a new connection. The legacy close reasonreplacedremains supported.A maintainer must deploy the relay changes with
wrangler deployforrose-party-relay; this PR does not deploy them. An updated client against the current server receives no replacement message, so the existing limitation remains. Older clients ignore the new message and retain their current behavior. No storage migration or compatibility-date change is needed.Validation:
python -m unittest party.tests.test_relay_replaced: 6 pass; 4 fail against base146f7986. Coverage includes replacement cleanup, ordinary reconnect, legacy close behavior and explicit resume.git diff --checkpasses.