Repository navigation
fix: start the live chat list over on a new connection - #3
Merged
Merged
Conversation
Checked against a real YouTube live on watch.typetype.video: the server numbers the messages of each connection chat-1, chat-2, ... and starts a new connection with the chat's recent backlog. Keeping ids across connections would have dropped the new messages after a reconnect as already seen, and keeping the list would have shown the backlog twice. The web client starts over on reconnect; so does the buffer now.
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
A new live chat connection now starts the message list over, as the web client does.
Why (real data)
Checked against a real YouTube live on
watch.typetype.video: the server numbers the messages of each connectionchat-1,chat-2, … and opens a new connection with the chat's recent backlog (56 messages in the first 9 s).LiveChatBufferde-duplicated by id across connections, so after a reconnect (or after the Chat chip is switched off and on) it would have taken the newchat-1…chat-Nfor already seen and dropped them. Keeping the old list instead would have shown the backlog twice. Ids are still de-duplicated within one connection.Changes
LiveChatBuffer:.connectedclears the list and the remembered ids.moderatorfield, avatar address).Verification
40 XCTest cases of the shared live chat code pass with Swift 6.0.3 on a Linux host, on top of
mainafter PR #2. TheiOSCI job on this PR is the check for the rest.Not verified: a reconnect on a device. I did not see the two fixes you added after PR #2 until after this was written: the Accept header (my request asked for
text/event-streamonly, the web client sendstext/event-stream, application/json) and the chat opening while the live starts (CoreMedia -16845). Thanks for catching both.AI disclosure
Prepared with AI assistance (Claude).