Repository navigation
Clarify client/state delta vs full updates - #101
Merged
Merged
Conversation
Resolve the contradiction (#98) between the client/state delta rule and the player fields marked "always required for players": deltas could not satisfy both. The "always" wording is dropped and the field-presence rules are scoped to a player's full state. Permit clients to send either deltas or full state updates with the server merging both (#91): the initial message MUST be complete, later messages MAY send only changed fields, and the server MUST retain the last value of any absent field. A single "Delta updates" note replaces the per-field repetition. Use RFC 2119 keywords in the affected passages.
maximmaxim345
added a commit
to Sendspin/sendspin-js
that referenced
this pull request
Jul 13, 2026
Every `client/state` previously resent the full player payload. Now the first send after each connect is a full snapshot and later sends are deltas carrying only the changed fields, which the server merges. This is specifically allowed since Sendspin/spec#101. Closes #114
maximmaxim345
added a commit
that referenced
this pull request
Aug 28, 2026
`client/state`, `server/state` and `group/update` each defined their own merge rules, and the three disagreed on whether merging was required, whether `null` cleared a field, how deep the merge went, and which message had to be complete (#149). Rather than reconcile them into one rule, drop merging. ## Changes: - All three messages carry full state on every message. - For `client/state` and `server/state` the role object is the unit: an included object carries that role's full state, and an omitted one leaves that role's state unchanged. Differential updates survive at role granularity, which is what the optional role objects were always for. - Drop the `| null` variant from leaf fields in the `metadata` and `color` objects. A role object may still be `null` in `server/state`, which is how the server ends a role's state when it drops the role from `active_roles`, and it was never a delta mechanism. - `group/update`'s `playback_state`, `group_id` and `group_name` are no longer optional. What this costs is bandwidth on metadata text, which is sent on state change rather than continuously; anything large already travels as a binary message. What it saves is the reconciliation layer on the receiving side, which has been a steady source of bugs and runs to a few hundred lines in a client that gets it right. ## Fields whose absence carried a second meaning Dropping the merge silently repurposes every optional field that used to mean "unchanged". Each one is now stated where the reader meets the field, rather than in a rule they have to remember: - `metadata.progress`: omitting it clears the client's position, so the server includes it in every `metadata` state that has a position to report. Track position is calculated from the current metadata state rather than from the last message that happened to include `progress`, which only made sense while absent meant unchanged. A resent `progress` is measured at the new `timestamp` rather than copied forward under it, which the merge rules used to make moot by never resending it at all. - The player state object's `supported_commands`: absence now says the player accepts no commands, which is what `[]` already says. The `?` goes rather than the redundant encoding staying around to silently revoke `set_output_delay`. Both other `supported_commands` in the spec are already non-optional. - Role objects themselves, covered by the omitted-object rule above. ## Follow-on cleanups - The player role's "Delta updates" paragraph is gone. - `REQUIRED for players` on the three non-optional fields in the player state object goes with it. It was an anchor for that paragraph, `?` already marks optionality (see the note under Communication), and the object is player-only. - The `available: false` handling no longer describes sending a `group/update` carrying only `playback_state`. This conflicts with #135 on `messaging.md`, `roles/metadata/v1.md` and `roles/color/v1.md`, in that PR's favour: with no merging, its rule that the first message after a scheduled one must repeat the scheduled message's fields has nothing left to do. Out of scope: the `management/set-pairing-config` patch semantics in `management.md`, which is a configuration API rather than state streaming. Closes #149 Refs #101 ## Breaking changes Both directions break, not just the server. Servers must send full `server/state` and `group/update` messages instead of deltas. A client that still merges keeps stale leaves, because clearing a leaf is now omission rather than an explicit `null`. Clients must send full `client/state` messages, and a player must now always carry `supported_commands`. A client that still sends deltas has them read as full state, so every field it omits is dropped rather than retained. Neither side errors. --------- Co-authored-by: Maxim Raznatovski <[email protected]>
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.
client/statesaid deltas "only include fields that have changed," butstatic_delay_ms,required_lead_time_ms, andmin_buffer_mswere marked "always required for players." A delta changing one field can't satisfy both rules (#98). Separately, the spec didn't make clear whether a client may send full state instead of a delta, or what the server does with an absent field (#91, item 3).Changes:
A missing field always means "unchanged" —
client/statehas no null-clearing semantics, so the server never has to tell a delta apart from a full update; it merges either one the same way.Out of scope: the other two items in #91 (default goodbye reason,
external_sourceSDK API).Closes #98
Refs #91