Skip to main content
Stream real-time audio from a computer’s virtual speaker over WebSocket. Audio is captured from the computer’s speaker output (PulseAudio on Linux, WASAPI loopback on Windows) and delivered as raw PCM in 20 ms frames. That is low-latency enough for live monitoring.

Connection URL

{instance_id} is the computer’s instance_id, returned by Create computer. It is also the last path segment of the computer’s connection_url.

Authentication

Pass the computer’s password as the token query parameter. Retrieve it from Get VNC password before connecting. That endpoint takes the computer’s UUID, not its instance_id. You need both identifiers: the UUID to fetch the password, the instance_id to build this URL. Send the password in ?token=, from a server or a browser. An Authorization header does not work on this socket, whether it carries an API key or the password: orgo-web accepts it, but it is not forwarded to the computer, which authenticates only ?token=. The connection opens and then closes with 1000. An API key in ?token= fails the same way, and from a browser (any connection with an Origin header) it is refused with 4001. Never put an account key in browser code. A connection with no usable credential is closed with code 4001. See Close codes.

Query parameters

string
required
Computer password, from Get VNC password. Optional only when the request carries a signed-in orgo.ai session cookie, in which case orgo-web supplies the password for you.
number
default:"24000"
Capture sample rate in Hz. On Linux any positive integer is accepted. On Windows only 8000 to 48000 is accepted. A missing, unparseable, or out-of-range value falls back to 24000.
number
default:"1"
Number of channels. Only 1 (mono) and 2 (stereo) are accepted; any other value is ignored and the default of 1 is used.

Audio format

Raw PCM: no codec, no container. Frame size follows the settings you request: sample_rate × channels × 2 × 0.02 bytes.

Protocol

Connection flow

  1. Client connects with ?token=.
  2. Server validates the credential.
  3. Server sends a JSON text frame echoing the configuration actually in use:
  4. Server starts capture and sends binary frames of raw PCM. If capture fails to start, an error text frame arrives instead and the connection closes normally.
  5. Client decodes and plays via the Web Audio API or any PCM-capable player.

Client → server messages

Stop capture and close the connection.
Ask for a pong.
A frame that parses as JSON but carries an unrecognised type is discarded silently. On Linux, a frame that is not valid JSON gets an error reply with the message invalid JSON, and the connection stays open. On Windows it is discarded silently.

Server → client messages

Sent immediately after the connection opens, before capture begins. Echoes the configuration in use, which is your requested values after validation.
string
Always "started".
number
Sample rate in Hz.
number
Number of channels.
Raw PCM audio data. Each binary frame contains signed 16-bit little-endian samples.At the default 24 kHz mono, each 20 ms frame is 960 bytes (480 samples × 2 bytes per sample).
Response to a ping.
Capture could not be started, or (on Linux) a client frame was not valid JSON.
string
Always "error".
string
Human-readable error description. invalid JSON for an unparseable client frame, on Linux only. When capture could not start, failed to start audio capture: … on Linux and audio capture unavailable: … on Windows.
A capture failure is followed immediately by a normal (1000) close, not by an error close code. Watch for this frame in your message handler. A client that only inspects close codes sees a clean disconnect and never learns why. An invalid JSON reply does not close the connection.

Examples

Playback tips

Browser autoplay

Browsers require a user gesture before AudioContext can play. Create the context inside a click handler, or call ctx.resume() after a user interaction.

Drift correction

Schedule buffers slightly ahead of real time and reset when drift exceeds ~150 ms. This prevents gaps and keeps latency low.

Heartbeat

Send a ping every 30 seconds to detect a dead connection early. Each message you send, ping included, also counts as activity for the idle timeout.

Sample rate

The default 24 kHz mono suits voice and system sounds. Pass sample_rate=48000 for higher fidelity, and size your playback buffers from the started frame rather than assuming the default.
Audio streaming requires the computer to be running; a stopped computer is closed with code 4003. Audio is captured from the computer’s speaker output, so any sound the computer produces is streamed: browser media, system alerts, application audio.

Idle disconnect

An idle audio socket is closed with code 4008. The audio the server streams does not count as activity. Messages you send on this socket do, including ping. It also borrows the activity of the other connections you hold to the same computer: a VNC or terminal session you are actively using keeps it open. In production the window is 30 minutes. Reconnect to resume.

Close codes