Repository navigation
Recover quiz delivery to phones on bad wifi and quiet slides - #9
Merged
Merged
Conversation
Phones could stay on "Waiting for the next question" while the presenter sat on a results slide. Since 0.7.0 phones rely on stream history, but a failed sync request stopped the presenter's keepalive, and concurrent requests could deliver an older state last. Presenter: one sync request in flight with the latest state, a 10s timeout, backoff retries up to 10s, a resend on presence changes and reconnects, and a 60s keepalive that keeps the stream history current. Broadcasts carry a seq so phones drop older ones. Phones: reconnect delays capped at 3s, a 6s timeout on handshakes that never complete (the AnyCable client otherwise stays "connecting" with no further attempt), only the last message of a history replay is applied, and one [slide-quiz:connection] console line per connection event. npm run test:integration runs a phone against a real anycable-go through a proxy that stalls or refuses connections.
…hake timing Every window that opens the deck runs a presenter manager, including a second tab or anyone reading the published slides. Each of them sent its own state when a vote arrived, and with the keepalive and presence resends they would have done so every minute and on every join, moving phones back to "Waiting". A window now broadcasts only after it has put a question on screen, or restored one after a reload. - Sync scheduling is one function that derives the next request from the last one: state changes after 200ms, resends with nothing changed after 2s, retries with backoff, otherwise the keepalive. - The presenter resends only when a phone joins, so a room joining at once shares one or two requests and leaves trigger none. - The broadcast seq is saved with the presenter state, so it keeps increasing after a reload even if the clock moved back. - A handshake gets 6s, then 8s after an abandoned attempt, so a slow but working connection still completes. The check runs every 500ms. - The reconnect attempt line now follows the "lost" line in the log. - Integration test for a phone that first opens on stalled wifi.
# Conflicts: # CHANGELOG.md
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.
At the October 9 talk, attendees scanned the QR code while the presenter stayed on a results slide. Two votes came in, and many phones stayed on "Waiting for the next question".
Causes
Changes
Presenter
seqthat survives a presenter reload, so phones drop older broadcasts.quiz-sync(Netlify and Vercel) forwards it.Phones
[slide-quiz:connection]console line per connection event.Testing
npm run test:integration: a phone against a realanycable-go, through a proxy that stalls or refuses connections. It's skipped whenanycable-goisn't installed.The same scenarios in headless Chromium:
The proxy blocks stalled connections forever. On real wifi, a hanging attempt usually completes by itself once packets flow again, so these numbers are the worst case.
After merge
quiz-syncfunctions again, so phones can drop older broadcasts usingseq.CHANGELOG.mdconflicts with Keep quiz endpoints same-origin and the broadcast URL out of errors #8; resolve by keeping both entries.