Subscribing to an Oracle Radio WebSocket Channel

Send a SUBSCRIBE message to join the current Radio WebSocket connection to one or more channels.

Permissions and Prerequisites

The following permissions and prerequisites apply to this operation.

RequirementValue
AuthenticationComplete the supported authentication path for the client before sending this operation. See authentication.
Radio permissionradio.channel.subscribe
Channel accessThe user must have subscribe access to each channel. Nonadministrators can subscribe only to channels in their domain. When ACL enforcement applies, the user must have explicit access to a restricted or hidden channel.
Session stateThe WebSocket connection must be open. This operation creates live membership for the current connection; it doesn't grant channel access.
Note

The contract doesn't define whether this subscription survives a reconnect or how it relates to a separately saved subscription.

Request

Send the SUBSCRIBE message as a JSON text message. Use channels for one or more channel names. The singular channel property is retained for compatibility.

NameData typeRequiredDefaultConstraintsDescription
typestringYesNoneMust be SUBSCRIBE.Identifies the channel-subscribe operation.
channelstringNoNoneSingle channel name.Compatibility property for requesting one channel.
channelsarray of stringsNoNoneChannel names.Channels to join.
userstringNoNoneDisplay name.Display name for the user.
Note

The contract defines both channel and channels as optional and doesn't define behavior when both or neither property is supplied. For a portable preview request, supply exactly one of these properties. Prefer channels.
{
  "type": "SUBSCRIBE",
  "channels": ["operations", "dispatch"],
  "user": "operator1"
}

Responses

The following table lists the messages the client can receive and explains their purpose.

Message typeKindDescription
SUBSCRIBEDDirect responseReports the result for each requested channel. A batch response can contain both successful and denied results.
SUBSCRIBE_DENIEDDenialReports that a single-channel request was denied, including the channel and reason.
ERRORErrorIndicates that the request message is invalid or couldn't be processed.

SUBSCRIBED Response

The following table describes the response properties, their data types, and whether they are required.

NameData typeRequiredDescription
typestringYesResponse type. The value is SUBSCRIBED.
channelstringNoChannel for a single-channel response.
channelsobjectNoResult keyed by requested channel name.
channels.*.subscribedbooleanNoWhether the connection joined the channel.
channels.*.modestringNoChannel mode.
channels.*.ownerstringNoChannel owner.
channels.*.busybooleanNoWhether the channel is busy.
channels.*.busyBystringNoUsername of the current talk-token holder.
channels.*.busyByDisplayNamestringNoDisplay name of the current talk-token holder.
channels.*.priorityintegerNoPriority of the current talk token.
channels.*.expiresAtstringNoTalk-token expiration date and time in ISO 8601 format.
channels.*.deniedbooleanNoWhether the channel request was denied.
channels.*.errorstringNoError for the channel request.
channels.*.reasonstringNoReason for a denial.
channels.*.codestringNoCode for a denial.
userstringNoUser display name returned with the result.
subscribedbooleanNoResult for a single-channel request.
busybooleanNoWhether a single requested channel is busy.
busyBystringNoTalk-token holder for a single requested channel.
{
  "type": "SUBSCRIBED",
  "channels": {
    "operations": {
      "subscribed": true,
      "mode": "normal",
      "busy": true,
      "busyBy": "dispatcher1",
      "priority": 50
    },
    "dispatch": {
      "subscribed": true,
      "mode": "normal",
      "busy": false
    }
  },
  "user": "operator1"
}