Repository navigation
Conversation
Add UDPClient.ResumeToken and DialUDPResume so a restarted app presents a stored credential instead of joining as a new peer, completing the stored resume token support that already existed for WebSocket clients on native and WebAssembly builds. The token carries the peer ID and resume secret through the existing hello fields, so the wire format is unchanged. Add WebSocketServer.ExtendGrace and UDPServer.ExtendGrace, capped by the new Auth.MaxGracePeriod, so a room can keep one dropped peer's seat longer than Auth.GracePeriod, whether the peer is still connected (the window applies at its drop) or already inside its grace period. Cover both transports with resume-token and grace tests, add a GOOS=js test of the WebSocket resume path against a fake browser socket, and update the en/zh netplay docs, changelog fragment and note. Fixes #1692
houko
force-pushed
the
feat/issue-1692-resume-token-udp-grace
branch
from
December 1, 2026 03:32
d91b95f to
9147103
Compare
This branch has not been deployed
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.
Summary
A browser tab that reloads or a phone app the OS kills mid-game could not resume its netplay session: the resume state lived only inside the transport object, so it joined as a new peer while its old session held a seat for the grace period, and the grace period was one value for the whole transport (#1692). This completes the stored resume token work already present for native and WebAssembly WebSocket clients:
UDPClient.ResumeTokenandDialUDPResumepresent the same versioned base64url credential through the existing encrypted UDP hello, falling back to a fresh join when the session has ended or the server rotated the secret, with the wire format unchanged.WebSocketServer.ExtendGraceandUDPServer.ExtendGracelet a room give one dropped peer a longer window thanAuth.GracePeriod, capped by the newAuth.MaxGracePeriod, whether the peer is still connected (the window applies at its drop) or already inside its grace period. Tests cover both transports, including aGOOS=jsWebSocket resume test against a fake browser socket, and the en/zh docs, changelog fragment and note are updated.Related issue
Fixes #1692
Verification
gofmt -l .produces no outputgo tool nsgo test ./...passes from the repository root — ran the affected package only,go tool nsgo test ./pkg/online/netplay/...(313 pass), plusGOOS=js GOARCH=wasm go test -exec ... ./pkg/online/netplay -run TestJS(both WebAssembly tests pass under node); the full repository suite is left to CIgo tool nsgo check -target macos,windows,linux,android,webpasses from the repository root —go tool nsgo check(host) passes andGOOS=js GOARCH=wasm go vet ./pkg/online/netplaypasses; the full multi-target run could not finish because the local disk is full (2 GB free), left to CIgo tool nsgo check -target ios,ios_simulatorpasses (if on macOS with Xcode) — not run; this change touches no platform-specific codebun run buildpasses (fordocs/orwebsite/changes) — not run for the same disk constraint; the change only mirrors markdown sections indocs/enanddocs/zh, left to CIdocs/en/anddocs/zh/updated (when applicable)Screenshots
No visible UI change.