Skip to main content

VNC WebSocket

POST 

/workstations/:workstation_id/vncwss

Connect to a Workstation's desktop using a browser-based VNC client such as noVNC. This endpoint returns a Secure WebSocket URL that can be used to establish a remote desktop connection directly in the browser.

VNC WebSocket for Browser Clients (NoVNC)

// setup request to get a VNC WebSocket URL to connect to the Workstation
const id = 'HvcqZjmeoPtP';
const url = `https://api.agentstation.ai/v1/workstations/${id}/vncwss`;

// Get VNC connection details from AgentStation API
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_token>'
}
});
const conn = await response.json();
// conn.url example: wss://connect.agentstation.ai/v1/vnc/cxBMzXSFUSXf

// Initialize noVNC
const rfb = new RFB(
document.getElementById('vnc-display'),
conn.url,
{
wsProtocols: ['binary'],
clipViewport: true,
scaleViewport: true,
resizeSession: true,
qualityLevel: 6,
compressionLevel: 2
}
);

// Handle connection events
rfb.addEventListener('connect', () => console.log('Connected to VNC'));
rfb.addEventListener('disconnect', () => console.log('Disconnected from VNC'));

Notes

  • The WebSocket connection will be automatically closed after the Workstation is released
  • The URL contains a secure random token that authenticates the connection
  • Default VNC settings:
    • Resolution: 1280x720
    • Color depth: 24-bit
    • Framerate: 30 fps
    • Encoding: Tight with JPEG compression

Request

Responses

Remote connection successful