Skip to content

[FEATURE]:Native P2P remote access from mobile via WebRTC (opencode remote --public) #19013

Description

@j0k3r-dev-rgl

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

OpenCode's README mentions a client/server architecture that could "allow OpenCode to run on your computer while you drive it remotely from a mobile app." I'd love to see this happen with minimal setup for the end user.

The idea is simple: run something like opencode remote --public, get a QR code in the terminal, scan it with your phone, and you're connected to your OpenCode session from anywhere. No VPN, no tunnels, no port forwarding.

The approach I'm suggesting is WebRTC DataChannels for the actual P2P connection between the PC and the phone. WebRTC handles NAT traversal through STUN, so in most cases (~85% of network setups) traffic flows directly between devices without any relay. The only piece of infrastructure needed is a tiny signaling service to exchange the initial handshake (~2KB of data, deleted after a few seconds). This could be a Cloudflare Worker or similar, essentially free at any reasonable scale.

For reconnection when the phone switches networks (WiFi to cellular, etc.), WebRTC supports ICE restart — the phone re-negotiates through the signaling server and the P2P link comes back in a few seconds.

A few things I think would make this practical:

  • opencode remote for LAN-only mode (zero external dependencies, just a local WebSocket server)
  • opencode remote --public for P2P over the internet via a project-hosted signaling endpoint
  • opencode remote --public --signal=https://custom-url for users who want to self-host the signaling piece

There's already community interest around this. #18796 built QR + mobile access using Wireguard, #10549 asked for QR hooks in web mode, and #17421 is an ecosystem project doing LAN-only remote control. This proposal would cover the "works outside your home network without extra setup" gap.

I'd be happy to help with implementation or discuss the approach further.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions