Dashboard
The dashboard at /sfu/admin/ lists every room, with its devices and viewers. This page shows how to open it on a deployed worker, and where to find the debug pages and the logs.
On localhost, the dashboard is always open. On any other host, it answers 404 until you protect it in one of these two ways.
Cloudflare Access (recommended)
-
In the Cloudflare dashboard, go to Zero Trust > Access controls > Applications.
-
Select Create new application, then Self-hosted and private.
-
Under Destinations, select Add public hostname. Enter your worker's hostname, and the path
sfu/admin. For example: subdomaincf-sfu-worker, domain<your-subdomain>.workers.dev, pathsfu/admin. -
Add a policy that allows your email address, and save.
-
Copy the application's Application Audience (AUD) Tag.
-
Copy your team domain from Zero Trust > Settings > Team domain, such as
your-team.cloudflareaccess.com. -
Set two secrets, with
wrangleror in your worker's Settings > Variables and Secrets:npx wrangler secret put ACCESS_TEAM_DOMAIN # your-team.cloudflareaccess.com npx wrangler secret put ACCESS_AUD # the AUD tag
Protect only the sfu/admin path. Do not use Add Workers or Protect this Worker: they protect the whole worker, and devices and viewers then cannot reach the token API and the sockets.
With these two secrets, only Access opens the dashboard. ADMIN_KEY no longer works.
ADMIN_KEY
Set a long random key:
npx wrangler secret put ADMIN_KEYThen enter it in Admin key on the dashboard.
Debug pages
Server state on the demo pages reads these:
/sfu/debug/rooms/<room ID>: a room, its viewers and its devices./sfu/debug/devices/<device ID>: one device.
On localhost they are open, like the dashboard. On other hosts, they answer 404 unless DEBUG_STATE is true, and then they need Authorization: Bearer <device or viewer public key>. They show SFU session IDs, so turn them on only while you test.
curl -H "Authorization: Bearer <public key>" https://<your host>/sfu/debug/devices/<device ID>Logs
The worker writes one JSON line for each event, such as device_gone, viewer_stale or device_id_in_use. To watch them:
npx wrangler tailYou can also search them in the Cloudflare dashboard, under your worker's Observability tab.
Configuration
Every secret and variable of the worker. Set secrets with npx wrangler secret put <NAME>, or in the dashboard under Settings > Variables and Secrets. Change...
Reference
How devices and viewers talk to the worker. Read these to write your own client. pi-webrtc and @mazupo/client already do all of this.

