# ECP-0046: Web Directory + WebRTC Signaling via Workers (Interim) ## Why The deployed website at `every.channel` is static and cannot yet join the QUIC/MoQ mesh directly. We still need a practical way for web viewers to: - see a global list of available live channels, and - connect to one without manual copy/paste. Browsers do support WebRTC DataChannels. We already use them as a bridge transport (ECP-0043), but we need a rendezvous mechanism for offers/answers and a directory that the website can query. ## Proposal Add a small `/api/*` surface to the existing Cloudflare Worker (same origin as the website): - `/api/directory` (GET): list announced live channels (short TTL). - `/api/announce` (POST): publish a channel entry `{stream_id,title,offer}` with a TTL. - `/api/answer` (POST/GET): store and retrieve WebRTC answers for a given `stream_id`. Add an `ec-node` mode that: - creates a WebRTC offer, - announces it to `/api/announce`, - polls `/api/answer?stream_id=...` until a browser answers, - streams CMAF objects once connected. Update the website UI to: - fetch `/api/directory`, - show a global list with a basic liveness heuristic (TTL), - on selection, generate a WebRTC answer and POST it to `/api/answer`. ## Notes / Risks - This is intentionally **centralized** for discovery/signaling. Data still flows P2P once connected. - Answers are treated as **one-shot** (first reader consumes) since one WebRTC offer maps to one peer connection. - Entries and answers are aggressively TTL'd and size-capped; this is not a spam-resistant directory. - Anti-junk / rate limiting / signing is not implemented in this ECP; it must be addressed before relying on this API for open public use. - This does not replace the long-term goal of native MoQ mesh discovery. ## Deployment Notes - Cloudflare requires a `workers.dev` subdomain to be created for the account even if we only use custom domains. If `wrangler deploy` fails with code `10063`, open the Workers landing page once in the Cloudflare dashboard, then retry deploy. ## Reversibility High. The API is an interim adapter to bridge web constraints. It can be removed or replaced by decentralized rendezvous without changing the core stream objects.