Cloudflare Workers relay
Deploy the Droidline relay to your own Cloudflare account when both the PC and the phones are behind NAT. No server to keep running.
Fits when neither the PC nor the phones can accept connections (for example a PC on a home router and phones on mobile data) and you do not want to run a server. Does not fit when you need more traffic than the free plan allows and do not want a paid plan, or you prefer to keep everything on hardware you control (use the VPS relay).
Both the PC and the phones connect out to the relay over WSS. The relay pairs them by server ID and device ID and forwards lines it cannot read. It is the same code for everyone; you deploy your own copy.
Deploy
With the button: open Deploy to Cloudflare, sign in, and when it asks for RELAY_TOKEN, paste a long random secret:
node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"
Or from a checkout:
cd relay/worker
npm ci
npx wrangler deploy
npx wrangler secret put RELAY_TOKEN
The deploy prints the relay's address, such as https://droidline-relay.your-account.workers.dev. Until the secret is set, the relay answers 503.
Connect the PC
droidline relay set https://droidline-relay.your-account.workers.dev <RELAY_TOKEN>
Restart droidline serve. The log shows relay connected. New phones get the relay from the pairing QR. Paired phones receive their own relay ticket the next time they connect on Wi-Fi; each ticket is bound to one phone, so a phone never holds the relay token itself.
Free plan
Durable Objects on Cloudflare's free plan allow 100,000 requests a day, and incoming WebSocket messages count as one request per 20 messages (Cloudflare pricing). An idle phone sends a ping every 25 seconds and the PC answers each one through the relay; together that comes to roughly 350 requests a day. Commands, screenshots and dumps add to that. When you outgrow the free plan, the Workers paid plan raises the limits.
Limits the relay enforces
- Each phone may send 50 lines a second, with bursts up to 200. Phones pace themselves to stay under it.
- A second connection for the same phone replaces the first.
- A pairing ticket cannot push out a phone that is already connected with its own ticket.