[feat] selectable peer signaling server + public-cloud fallback - #27
Merged
Conversation
- peerServer.js: three modes (default self-hosted / public cloud / custom), persisted to localStorage; self-hosted host + STUN/TURN read from VITE_* env - peerHandler: build Peer options from the selected mode; in default mode, if the pinned self-hosted server never opens, rebuild against the public PeerJS cloud (custom/public never fall back). Rewire + rebind voice on fallback - voiceChat: split attachVoiceToPeer out of initVoiceChat so the fallback can rebind the incoming-call handler without duplicating window listeners - Settings: new Connection section (mode select + custom host/port/path/TURN) - .env.example documents the self-hosted/TURN vars (real .env stays gitignored) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Adds a runtime-selectable signaling server so we can move off the rate-limited public PeerJS cloud onto our own EC2-hosted PeerServer + coturn (see docs/tf), with a safety net.
Modes (Settings -> Connection)
VITE_*env; falls back to the public PeerJS cloud if the pinned server never opens. No env => just the public cloud.Mode + custom fields persist to localStorage. Local dev (localhost) still uses the :9001 dev server in default mode.
Changes
src/lib/peerServer.js(new) - mode resolution + ICE builder, SSR-safe, VITE_* env.peerHandler.svelte.js- build Peer options from the mode; connect-time fallback rebuilds against the public cloud and re-wires (custom/public never fall back).voiceChat.js- splitattachVoiceToPeerout ofinitVoiceChatso the fallback rebinds the incoming-call handler without duplicating window listeners.Settings.svelte- new Connection section..env.exampledocuments the self-hosted/TURN vars (real.envstays gitignored).Verification
npm run buildpasses (prerender clean = peerServer.js SSR-safe).npx svelte-checkheld at baseline 502/77.network-disconnecttwo-peer e2e passed - and since the harness host istheprototype.appwith.envpresent, that run exercised the fallback path (self-hosted DNS-less -> public -> connected).🤖 Generated with Claude Code