2025-12-14 01:54:58 +00:00
---
summary: "Runbook: connect/pair the Android node to a Clawdis Gateway and use Canvas/Chat/Camera"
read_when:
- Pairing or reconnecting the Android node
- Debugging Android bridge discovery or auth
- Verifying chat history parity across clients
---
# Android Node Connection Runbook
Android node app ⇄ (mDNS/NSD + TCP bridge) ⇄ **Gateway bridge** ⇄ (loopback WS) ⇄ **Gateway**
The Gateway WebSocket stays loopback-only (`ws://127.0.0.1:18789` ). Android talks to the LAN-facing **bridge** (default `tcp://0.0.0.0:18790` ) and uses Gateway-owned pairing.
## Prerequisites
- You can run the Gateway on the “master” machine.
2025-12-17 15:29:19 +01:00
- Android device/emulator can reach the gateway bridge:
- Same LAN with mDNS/NSD, **or**
- Same Tailscale tailnet using Wide-Area Bonjour / unicast DNS-SD (see below), **or**
- Manual bridge host/port (fallback)
2025-12-14 01:54:58 +00:00
- You can run the CLI (`clawdis` ) on the gateway machine (or via SSH).
## 1) Start the Gateway (with bridge enabled)
Bridge is enabled by default (disable via `CLAWDIS_BRIDGE_ENABLED=0` ).
```bash
pnpm clawdis gateway --port 18789 --verbose
```
Confirm in logs you see something like:
- `bridge listening on tcp://0.0.0.0:18790 (Iris)`
2025-12-17 15:29:19 +01:00
For tailnet-only setups (recommended for Vienna ⇄ London), bind the bridge to the gateway machine’ s Tailscale IP instead:
2025-12-17 17:01:30 +01:00
- Set `bridge.bind: "tailnet"` in `~/.clawdis/clawdis.json` on the gateway host.
2025-12-17 15:29:19 +01:00
- Restart the Gateway / macOS menubar app.
2025-12-14 01:54:58 +00:00
## 2) Verify discovery (optional)
From the gateway machine:
```bash
dns-sd -B _clawdis-bridge._tcp local.
```
More debugging notes: `docs/bonjour.md` .
2025-12-17 15:29:19 +01:00
### Tailnet (Vienna ⇄ London) discovery via unicast DNS-SD
Android NSD/mDNS discovery won’ t cross networks. If your Android node and the gateway are on different networks but connected via Tailscale, use Wide-Area Bonjour / unicast DNS-SD instead:
1) Set up a DNS-SD zone (example `clawdis.internal.` ) on the gateway host and publish `_clawdis-bridge._tcp` records.
2) Configure Tailscale split DNS for `clawdis.internal` pointing at that DNS server.
Details and example CoreDNS config: `docs/bonjour.md` .
2025-12-14 01:54:58 +00:00
## 3) Connect from Android
In the Android app:
2025-12-14 02:01:42 +00:00
- The app keeps its bridge connection alive via a **foreground service** (persistent notification).
2025-12-14 01:54:58 +00:00
- Open **Settings** .
- Under **Discovered Bridges** , select your gateway and hit **Connect** .
- If mDNS is blocked, use **Advanced → Manual Bridge** (host + port) and **Connect (Manual)** .
After the first successful pairing, Android auto-reconnects on launch:
- Manual endpoint (if enabled), otherwise
- The last discovered bridge (best-effort).
## 4) Approve pairing (CLI)
On the gateway machine:
```bash
clawdis nodes pending
clawdis nodes approve < requestId >
```
Pairing details: `docs/gateway/pairing.md` .
## 5) Verify the node is connected
2025-12-18 00:37:40 +00:00
- Via nodes status:
2025-12-14 01:54:58 +00:00
```bash
2025-12-18 00:37:40 +00:00
clawdis nodes status
2025-12-14 01:54:58 +00:00
```
- Via Gateway:
```bash
clawdis gateway call node.list --params "{}"
```
## 6) Chat + history
The Android node’ s Chat sheet uses the gateway’ s **primary session key** (`main` ), so history and replies are shared with WebChat and other clients:
- History: `chat.history`
- Send: `chat.send`
- Push updates (best-effort): `chat.subscribe` → `event:"chat"`
## 7) Canvas + camera
2025-12-18 11:39:30 +01:00
### Gateway Canvas Host (recommended for web content)
If you want the node to show real HTML/CSS/JS that the agent can edit on disk, enable the Gateway canvas host and point the node at it.
1) On the gateway host, enable `canvasHost` in `~/.clawdis/clawdis.json` :
```json5
{
canvasHost: { enabled: true, root: "~/clawd/canvas", port: 18793, bind: "lan" }
}
```
2) Create `~/clawd/canvas/index.html` .
3) Navigate the node to it (LAN):
```bash
clawdis nodes invoke --node "< Android Node > " --command canvas.navigate --params '{"url":"http://< gateway-hostname > .local:18793/"}'
```
This server injects a live-reload client into HTML and reloads on file changes.
2025-12-14 01:54:58 +00:00
Canvas commands (foreground only):
2025-12-18 10:44:50 +01:00
- `canvas.eval` , `canvas.snapshot` , `canvas.navigate` (switches to web mode), `canvas.setMode` (use `"canvas"` to return)
- A2UI: `canvas.a2ui.push` , `canvas.a2ui.reset` (`canvas.a2ui.pushJSONL` legacy alias)
2025-12-14 01:54:58 +00:00
Camera commands (foreground only; permission-gated):
- `camera.snap` (jpg)
- `camera.clip` (mp4)
See `docs/camera.md` for parameters and CLI helpers.