dshgo-ego-remote: Forward Mobile Browser Pages to Desktop Browser

Introduction

During agent development, it’s common to need to debug or demo a web page on a phone, but the computer screen can’t see or interact with it. Traditional approaches either require wireless debugging tools (which need extra software) or screen mirroring to the computer (which often suffers from lag or high input latency).

DSH Go offers an “everything is a plugin” extension model. A community developer has built a plugin for the ego browser scenario that forwards the currently running browser page on a phone into an interactive web page, allowing you to view and interact with it in real time from a computer or tablet browser.

Plugin Overview

dshgo-ego-remote is a mobile plugin for DSH Go, published by maintainer xqe-bkflda. It leverages the Chrome DevTools Protocol built into the ego browser to render the phone’s current browser page as a web page on a computer browser (over the same WiFi), supporting operations such as clicking, typing, scrolling, and keyboard input.

The plugin defaults to port 7788 and uses WebSocket binary frames to transmit the screen (raw JPEG bytes) and text frames to transmit input commands. Both the screen feed and interactions run over a single connection, resulting in low latency and small payload. In testing, it achieves 54 fps with an average of 35 KB per frame at a 390×889 viewport.

Installation & Activation

One-Click Install

curl -fsSL https://raw.githubusercontent.com/xqe-bkflda/dshgo-ego-remote/main/install.sh | sh

Manual Install

cp -r dshgo-ego-remote "$DSH_HOME/dsh-go/plugins/local-ego-remote"
dsh plugin --profile web add "$DSH_HOME/dsh-go/plugins/local-ego-remote"

After installation, find the “Browser Remote” panel in the DSH Go App. Path: Conversation Details → Plugins tab / All Features → Plugins group / Chat page “Plugins” capsule.

Panel Startup

Open the “Browser Remote” panel and click “Start/Repair” to run the service in the background. The default port is 7788, and it will retain the last used port after a restart.

For foreground execution or port change:

cd /root/workspace/ego-remote
./start.sh                      # Foreground, Ctrl-C to stop
./start.sh --bg --port 9000     # Background on port 9000
./start.sh --stop               # Stop only

Port priority: --port > PORT environment variable > .port file (last used) > 7788. Without root privileges, do not use ports below 1024.

After startup, the logs will print the local address and LAN address in the following format:

  • http://127.0.0.1:7788/?t=xxxxxxxx — local access
  • http://192.168.x.x:7788/?t=xxxxxxxx — phone/computer access on the same WiFi

The token after t= is stored in the .token file and persists across restarts (deleting the file generates a new token).

Web Interaction Capabilities

Once you open the web URL, the following operations are supported:

Operation Description
Dropdown Lists all page targets in ego; select one and click “Connect”
Mouse click / drag Real clicks via Input.dispatchMouseEvent
Scroll wheel Forwarded to scroll the remote page
Direct keyboard input Printable characters go through Input.insertText; arrow keys / Enter go through dispatchKeyEvent
“Keyboard” button Pops up the system IME on the phone and forwards characters one by one
Touch tap / drag Automatically routed through Input.dispatchTouchEvent
← → ↻ History back/forward, reload
Address bar Type a URL and press Enter; the remote page navigates directly
1:1 Toggles between “fit width” and “native pixels (draggable full view)”

Opening the web page automatically connects to the first page—no manual selection needed. The “Idle” indicator in the top-right corner means the page has no changes (screencast only emits frames when the screen changes; the server sends a confirmation frame every 1.5 seconds to verify the target is still alive).

The ego-remote page itself is not listed and cannot be taken over, preventing infinite recursion.

Transport Protocol

The screen feed uses binary frames—JPEG without base64, no longer squeezed into an SSE text stream:

[0x01][uint32 metaLen][meta JSON][JPEG raw bytes]

Commands use text frames on the same connection:

{t:'input', type:'mouseMoved', x, y}

When the client’s decoding falls behind, only the latest frame is kept. The server drops old frames when bufferedAmount > 400KB, so latency doesn’t accumulate. metaLen === 0 means reuse the previous frame’s meta, eliminating per-frame JSON resends.

Resolution follows the client’s display size: the web page sends stage.clientWidth × devicePixelRatio upstream, and the server reopens the screencast at that width. A 390-wide phone screen no longer receives 1280-wide JPEGs, reducing decode volume by roughly 1/9.

Phone Panel

The “Browser Remote” panel directly displays the local address, LAN address, port, number of active viewers, and forwarding width. A “Copy Local URL” button copies the full URL with token in one tap. “Change Port” actually restarts the service on the next port—it’s not just a display change. “Start/Repair” and “Stop” buttons control the process.

Parameters & API

Environment Variables

Variable Default Description
PORT 7788 Listen port (--port takes priority)
HOST 0.0.0.0 Set to 127.0.0.1 for local-only access
QUALITY 72 JPEG quality; lower values save bandwidth
MAX_WIDTH 1280 Screencast width cap (client requesting wider won’t exceed this)
EGO_STATE /root/.local/state/ego-lite-linux ego state directory, used to locate browser.json
EGO_REMOTE_DIR Plugin’s built-in server/ Override with your own forwarding service directory
TOKEN Random, persisted Force a specific access token

HTTP API

All HTTP endpoints require ?t=<token>:

  • GET /api/status → {ok, port, token, urls, attached, clients, pages, castW}
  • GET /api/pages → {ok, pages:[{id,url,title}], current}
  • GET /api/attach?id=<targetId> → Take over this page, start emitting frames
  • POST /api/command → {cmd, ...}, supported cmds: reload back forward navigate scrollBy clickText eval
  • GET /api/detach → Disconnect

WebSocket API

WebSocket GET /ws?t=<token> (after upgrade):

  • Receive: binary frame packets (see above); text {k:'hello'|'attached'|'nav'|'detached'|'result'}
  • Send: {t:'resize',w,h}, {t:'input', ...} (same input types as before), {t:'command',cmd,id}, {t:'attach',id}

Notes

  • After ego browser is closed by dsh (default: 15 minutes idle), the web page will show “Target closed.” Reopen the browser via dsh, then refresh the web page.
  • Only one page is mirrored at a time; switching pages disconnects the previous one first.
  • The service provides no isolation beyond token authentication: anyone with the token can operate this browser. Do not expose 0.0.0.0:7788 to the public internet.

Use Cases

Ideal for developers and testers who need to debug web page effects on a phone, demo agent interaction scenarios, or remotely control phone browser operations. Before use, review the plugin source code and license to ensure it fits your use case.

Summary

dshgo-ego-remote is a practical DSH Go plugin that uses the native Chrome DevTools Protocol to forward a phone browser page in real time to a computer browser with low latency and low bandwidth usage, supporting full mouse, keyboard, and touch interaction. For developers who need remote debugging or demoing of agent web interactions, it’s a lightweight solution that requires no extra software and works over the same WiFi.

  • Catalog page: https://www.skillhub.cn/plugins/xqe-bkflda/dshgo-ego-remote
  • GitHub: https://github.com/xqe-bkflda/dshgo-ego-remote
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye