Repository navigation
Hold the player's first client/state until the clock syncs - #236
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change that defers player state reporting until clock synchronization.
No open issues 🎉
What changed in this PR
This PR prevents players from leaving their group on reconnect by withholding client/state until clock synchronization, rather than initially reporting available: false.
Changes:
- Delay player state updates until the clock synchronizes, then report
available: true. - Preserve immediate state updates for clients without the player role.
- Update unit tests and fixtures to cover deferred state reporting and synchronized activation.
| File | Description |
|---|---|
tests/unit/protocol-handler.test.ts |
Verify deferred player state, pending volume changes, and immediate non-player state. |
tests/unit/core.test.ts |
Synchronize the clock before activation in state-forwarding tests. |
tests/unit/core-encryption.test.ts |
Synchronize the clock in encrypted state-reporting tests. |
src/core/protocol-handler.ts |
Gate player state updates on clock synchronization and report availability as true. |
Review effort: Balanced
33 tasks done
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.
What does this implement/fix?
The player sent its first
client/statewithavailable: falseuntil its clock synced. A server following the updated spec ungroups a client that opens withavailable: false, so the player would leave its group on every reconnect.The player now holds back its first
client/stateuntil its clock syncs and always reportsavailable: true. Clients without the player role still send it right away.Related issue or spec PR (if applicable):
client/stateuntil its clock syncs spec#349Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies