core: Implement cross-context LocalConnection via BroadcastChannel#23212
Open
Bubby4j wants to merge 3 commits intoruffle-rs:masterfrom
Open
core: Implement cross-context LocalConnection via BroadcastChannel#23212Bubby4j wants to merge 3 commits intoruffle-rs:masterfrom
Bubby4j wants to merge 3 commits intoruffle-rs:masterfrom
Conversation
38a552c to
3e161a8
Compare
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.
(note: LLM generated code by a Rust newbie)
Overview
This PR implements complete cross-context
LocalConnectionsupport for the Ruffle web player, enabling communication between different movies on a page, across iframes, and between different tabs/windows on the same origin.Previously,
LocalConnectiononly worked within a single Ruffle instance. This implementation introduces aBroadcastChannel-based backend for transport and alocalStorage-based registry for listener discovery and health tracking.Key Features
BroadcastChannelAPI to deliver AMF-serialized messages between Ruffle instances.localStorageto track activeLocalConnectionlisteners across the origin, implementing the "heartbeat" pattern used by Flash to prune stale connections.Playerand triggers an immediate local connection update upon receiving a channel event, bypassing the standard frame-rate-bound polling loop.get_superdomain.beforeunloadto ensurelocalStoragelocks are released even if a tab is closed abruptly.Limitations
Testing
Automated Tests
web/packages/selfhosted/test/integration_tests/local_connection_cross_tab/:connect/sendbetween tabs.beforeunload.get_superdomainto verify IP address and domain split logic.Manual Verification
Related
#259
#2410
#10493
#10068