Prototype direct Personal WP desktop access#3758
Draft
akirk wants to merge 1 commit into
Draft
Conversation
aa0319e to
07016be
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.
What this explores
This is a smaller, trunk-based alternative to #3746. It keeps the same product goal: let someone open the Personal WP instance running on their phone from a desktop browser while the phone remains nearby and connected.
The main difference is transport. #3746 proxies WordPress HTTP requests and responses through the PHP relay. This PR uses the PHP relay only for rendezvous and WebRTC signaling, then sends WordPress HTTP traffic over a direct browser-to-browser WebRTC DataChannel.
Related PRs:
User flow
On the phone:
On the desktop:
/connecton the same Personal WP deployment.While connected, the desktop page renders the WordPress instance that is still running on the phone.
Architecture
The PHP relay stores only session and signaling data in one MySQL table:
The JSON payload contains:
It does not expose a
/relay/:session/request/*HTTP proxy in this branch.The request path is:
/scope:default/....playgroundClient.request(...).Responsefor the iframe.So WordPress request/response bodies are intended to stay out of PHP and MySQL in this approach.
Difference from #3746
#3746:
This PR:
trunk.TunnelHostHTTP polling implementation.Privacy and data handling
This approach reduces what the relay sees. MySQL still temporarily stores WebRTC setup metadata, but it should not store WordPress HTTP bodies, cookies, admin requests, HTML, CSS, JS, media, or form submissions.
The desktop and phone exchange those request/response payloads directly over the WebRTC DataChannel.
Server configuration
The relay reads DB configuration from these env/server variables, in order:
PLAYGROUND_RELAY_DB_HOST,MYWP_DB_HOST,DB_HOSTPLAYGROUND_RELAY_DB_USER,MYWP_DB_USER,DB_USERPLAYGROUND_RELAY_DB_PASSWORD,MYWP_DB_PASSWORD,DB_PASSWORDPLAYGROUND_RELAY_DB_NAME,MYWP_DB_NAME,DB_NAMEPLAYGROUND_RELAY_DB_PORT,MYWP_DB_PORT,DB_PORTPLAYGROUND_RELAY_PUBLIC_BASE_URLmay be set to force generated desktop share URLs.The table is created lazily with
CREATE TABLE IF NOT EXISTS.Caveats
This is a prototype.
The WebRTC peer connection currently uses no STUN or TURN servers:
That keeps the first version focused on same-network/direct connectivity. It may fail on networks where the browsers cannot discover a usable direct route. Adding STUN would likely improve direct connection setup. Adding TURN would improve reliability further, but TURN would relay encrypted WebRTC traffic and change the privacy tradeoff.
The phone tab must stay open. The desktop is a viewer/control surface for the running phone Playground runtime.
Installing apps via postMessage from the desktop viewer is still reported as unsupported for now.
Validation
Ran:
php -l packages/playground/personal-wp/public/relay.phpnpm exec nx typecheck playground-personal-wpnpm exec nx typecheck playground-remoteI did not run the full build or deployment scripts.