Workflow: Transmitting Audio by Using the Oracle Radio WebSocket API
Acquire the talk floor, start a transmission, send binary audio, end the transmission, and release the talk token.
Before You Begin
Open an authenticated WebSocket connection. Follow Subscribing to an Oracle Radio WebSocket Channel, and verify that the target channel's subscribed result is true. The Radio user must have talk access, radio.talk.request, and radio.audio.transmit.
Do not reuse a talk token across connections or continue sending after an interruption, expiration, timeout, error, or disconnect.
Transmitting Audio
-
Follow Requesting the Oracle Radio WebSocket Talk Floor to send
REQUEST_TALKfor the subscribed channel.{ "type": "REQUEST_TALK", "channel": "operations", "priority": 50 } -
Wait for
GRANTED. Save the returnedtokenandexpiresAt. Do not start a transmission afterDENIED,QUEUED, orTALK_DENIED. -
Follow Starting an Oracle Radio WebSocket Audio Transmission to send
STARTwith the granted token and the audio properties that the client will use.{ "type": "START", "token": "550e8400-e29b-41d4-a716-446655440000", "format": "opus", "sampleRate": 8000, "channels": 1, "bitrate": 16000, "frameSize": 20 }The initiating connection does not receive its own
TRANSMISSION_STARTevent. After the client reports that it successfully sentSTART, continue unless the service sendsERROR. -
Follow Sending Oracle Radio WebSocket Audio to send each encoded packet as one unframed binary WebSocket message. Continue only while the connection is open and the talk token is valid.
-
After sending the final binary packet, follow Ending an Oracle Radio WebSocket Audio Transmission to send
END.{ "type": "END", "token": "550e8400-e29b-41d4-a716-446655440000", "duration": 3.5 }The initiating connection does not receive its own
TRANSMISSION_ENDevent. Stop sending audio after the client reports that it successfully sentEND. -
Follow Releasing the Oracle Radio WebSocket Talk Floor to send
RELEASE_TALKwith the talk token and channel.{ "type": "RELEASE_TALK", "token": "550e8400-e29b-41d4-a716-446655440000", "channel": "operations" }Wait for
RELEASED. Other channel subscribers can receiveCHANNEL_OPEN.
Handling Alternate Outcomes
Use the following outcomes to determine how to continue or recover an audio transmission.
| Outcome | Client action |
|---|---|
QUEUED | Do not send START. Retain the request state and wait for a later GRANTED response with fromQueue set to true. If the connection closes first, discard the queued state. |
DENIED | Do not send audio. Use the returned busy-holder or reason information, if present, to decide whether to request the talk floor later. |
TALK_DENIED | Do not send audio. Correct the Radio permission or channel-access problem identified by the returned reason and code. |
INTERRUPTED | Stop sending binary audio immediately and discard the talk token. Request a new token before attempting another transmission. |
TOKEN_EXPIRED | Stop sending binary audio, discard the expired token, and request a new token if the user still needs to transmit. |
TRANSMISSION_TIMEOUT | Stop sending binary audio. The service has automatically released the token, so request a new token before another transmission. |
ERROR or TOKEN_INVALID | Stop sending binary audio. Correct the request or state problem before restarting the talk-floor flow. |
| WebSocket disconnect | Stop capture and sending, discard the talk token, reconnect, subscribe to the channel again, and start with a new REQUEST_TALK. |