Documentation Index
Fetch the complete documentation index at: https://docs.optexity.com/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/v1/tasks//stream
Returns a short-lived WebSocket URL that streams the live browser view of a running task. Pair it with a noVNC client (e.g.@novnc/novnc) to embed the live screen in your own dashboard.
Description
While a task is running, its browser is rendered in a headed Chromium inside the worker container and exposed over VNC viawebsockify. This endpoint resolves a task to a WebSocket URL (wss://...) you can pass directly to a noVNC RFB client to render the live view in a <canvas>.
The URL is only valid while the task is actively running. Once the task finishes (success / failure / cancellation) the upstream WebSocket closes and the endpoint returns an error.
Authentication
Requires an API key in thex-api-key header. The same key used for POST /api/v1/inference works here.
Parameters
Path Parameters
-
task_idstringrequired UUID of the task whose live stream you want. Obtain this from thetask_idfield in your task creation response or task listing.
Headers
-
x-api-keystringrequired Your Optexity API key.
Code Examples
Fetch the stream URL
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
stream_url | string | A wss:// WebSocket URL that speaks the noVNC wire protocol. Pass it directly to a RFB constructor. |
Error Responses
401 Unauthorized
404 Not Found
409 Conflict
Frontend Integration
Use@novnc/novnc’s RFB class. It attaches to a plain <div> and renders the live view into a <canvas> inside it. The full reference implementation is in LiveStreamViewer.jsx in the Optexity dashboard.
Install with
npm install @novnc/novnc.Reference implementations
Key RFB options
| Option | Recommended | Why |
|---|---|---|
viewOnly | true | Read-only preview — disables input forwarding so a dashboard viewer can’t accidentally take over the browser. |
scaleViewport | true | Scales the remote framebuffer to fit your container without resizing the actual browser. |
resizeSession | false | Don’t try to negotiate a different remote display size — the worker runs at a fixed 1920×1080. |
wsProtocols | ["binary"] | Required for websockify’s binary subprotocol. |
credentials | {} | The stream is auth’d via the signed token in the URL — no VNC password is needed. |
Lifecycle tips
- Fetch a fresh
stream_urlon every (re)connect attempt — the token is short-lived. - Call
rfb.disconnect()on component unmount to release the underlying WebSocket. - Handle the
disconnectevent:e.detail.clean === truetypically means the task finished gracefully (show “Stream ended”);clean === falseis a genuine network/auth failure (show retry). - The endpoint returns
409while the task is queued — poll task status first and only call/streamonce the task isrunning.
Related
- Inference Endpoint — Submitting tasks
- noVNC — Upstream client library