Qwen-Audio-Live AOQ access
Obtain temporary connection details over WebSocket and establish an AOQ media connection.
Use the control WebSocket to establish the session and obtain temporary credentials. Once AOQ is connected, use it to send and receive audio. Keep the control WebSocket open throughout the session.
Open the control connection
Connect as described in WebSocket access. In session.update, add the following fragment to the session object to use AOQ for audio:
{"transport":{"type":"aoq","aoq":{"ws_audio":false}}}
Connect to the AOQ relay
- Read the connection details from
session.transport.aoqinsession.updated. - Pass
sid,aoqTokenForClient,clientRelayCertFingerprint,extraInfo.workspaceIdHash, andclientRelayEndpointsto the AOQ Client SDK. Each relay entry containsendpoint,port, androute_index. Use the credentials and endpoints returned for the same session. - Use the returned
sidand temporary credentials to initiate the AOQ connection within 5 minutes of receivingsession.updated. Wait for the connected callback before starting audio capture and transmission. Keep the control WebSocket open. - Stop audio capture and playback, disconnect AOQ, and close the WebSocket session when finished.
AOQ connection details contain temporary credentials. Obtain new credentials for each new session and keep them out of logs.
Receive server events
Once the media connection is ready, receive server events over the control WebSocket or the AOQ data track. To receive events over AOQ, subscribe to the data track and handle the SDK data message callback. The macOS SDK uses onDataMsg:. If both paths deliver an event with the same event_id, process it once.
Audio transport
Send input audio over AOQ. The aoq.ws_audio setting controls whether WebSocket also receives a copy of the output audio. It defaults to false. Sending session.input_audio.append over WebSocket in an AOQ session returns audio_requires_aoq_media. See the client events and server events references.