> For the complete documentation index, see [llms.txt](https://docs.orchard.airoverflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orchard.airoverflow.com/api/resources/websockets.md).

# WebSocket channels

Interactive and streaming features are WebSockets under `/ws` on the control plane host (`wss://` in production, `ws://` for a local dev server).

## Authentication

A browser cannot set an `Authorization` header on a WebSocket, so the token goes in the query string, with the org and workspace when a JWT caller needs them:

```
wss://<host>/ws/remote/<id>/shell?token=<api-key-or-jwt>&org=<slug>&ws=<slug>
```

A bad or missing token closes the socket with code `4401`.

## External (cloud) sandbox channels

Addressed by record id.

| Path                    | Direction        | Frames                                                                                   |
| ----------------------- | ---------------- | ---------------------------------------------------------------------------------------- |
| `/ws/remote/<id>/shell` | duplex           | Raw terminal bytes both ways. No resize framing: a resize JSON would land as keystrokes. |
| `/ws/remote/<id>/logs`  | server to client | Text frames of the sandbox's log output.                                                 |

## Node sandbox channels

Addressed by uuid.

| Path                                          | Purpose                                                                  |
| --------------------------------------------- | ------------------------------------------------------------------------ |
| `/ws/sandboxes/<uuid>/logs`                   | Device log stream (JSON lines).                                          |
| `/ws/sandboxes/<uuid>/shell`                  | Interactive shell (text, with a `{"t":"resize",...}` control frame).     |
| `/ws/sandboxes/<uuid>/vnc`                    | Raw RFB for noVNC (iOS VMs).                                             |
| `/ws/sandboxes/<uuid>/screen/stream`          | Live screen: H.264, or PNG frames per source.                            |
| `/ws/sandboxes/<uuid>/screen/webrtc`          | WebRTC signaling (SDP/ICE as JSON); media flows peer to peer.            |
| `/ws/sandboxes/<uuid>/webrtc/<path>`          | WebRTC sub-channel.                                                      |
| `/ws/sandboxes/<uuid>/adb`                    | Raw adb transport tunnel (Android).                                      |
| `/ws/sandboxes/<uuid>/gdb`                    | Raw gdb-remote tunnel to a debug sandbox's guest-kernel stub.            |
| `/ws/sandboxes/<uuid>/debugger/console`       | lldb console (rootable images).                                          |
| `/ws/sandboxes/<uuid>/tunnel`, `/tunnel/data` | Reverse proxy control and data channels.                                 |
| `/ws/sandboxes/<uuid>/mitm/flows`             | Captured request/response summaries.                                     |
| `/ws/sandboxes/<uuid>/frida/stream`           | Live frida script messages (client sends the script as the first frame). |

## Jobs

| Path                                 | Purpose                                                   |
| ------------------------------------ | --------------------------------------------------------- |
| `/ws/jobs/<node>/<kind>/<name>/logs` | Live log of a long-running job (VM build, image install). |

## Client notes

* The CLI and SDKs wrap these: `orchard remote shell`, `orchard remote logs`, `orchard shell`, `orchard screen`, and the SDK `shell()` / `logs()` channels.
* The interactive remote shell is raw bytes; drive it as a PTY, not line input.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.orchard.airoverflow.com/api/resources/websockets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
