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.

Transmitting Audio

  1. Follow Requesting the Oracle Radio WebSocket Talk Floor to send REQUEST_TALK for the subscribed channel.

    {
      "type": "REQUEST_TALK",
      "channel": "operations",
      "priority": 50
    }
  2. Wait for GRANTED. Save the returned token and expiresAt. Do not start a transmission after DENIED, QUEUED, or TALK_DENIED.

  3. Follow Starting an Oracle Radio WebSocket Audio Transmission to send START with 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_START event. After the client reports that it successfully sent START, continue unless the service sends ERROR.

  4. 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.

  5. 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_END event. Stop sending audio after the client reports that it successfully sent END.

  6. Follow Releasing the Oracle Radio WebSocket Talk Floor to send RELEASE_TALK with the talk token and channel.

    {
      "type": "RELEASE_TALK",
      "token": "550e8400-e29b-41d4-a716-446655440000",
      "channel": "operations"
    }

    Wait for RELEASED. Other channel subscribers can receive CHANNEL_OPEN.

Handling Alternate Outcomes

Use the following outcomes to determine how to continue or recover an audio transmission.

OutcomeClient action
QUEUEDDo 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.
DENIEDDo not send audio. Use the returned busy-holder or reason information, if present, to decide whether to request the talk floor later.
TALK_DENIEDDo not send audio. Correct the Radio permission or channel-access problem identified by the returned reason and code.
INTERRUPTEDStop sending binary audio immediately and discard the talk token. Request a new token before attempting another transmission.
TOKEN_EXPIREDStop sending binary audio, discard the expired token, and request a new token if the user still needs to transmit.
TRANSMISSION_TIMEOUTStop sending binary audio. The service has automatically released the token, so request a new token before another transmission.
ERROR or TOKEN_INVALIDStop sending binary audio. Correct the request or state problem before restarting the talk-floor flow.
WebSocket disconnectStop capture and sending, discard the talk token, reconnect, subscribe to the channel again, and start with a new REQUEST_TALK.