Subscribing an Oracle Radio User to WebSocket Channels

Send a SUBSCRIBE_USER message to add another connected Radio user to one or more live channel subscriptions.

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.user.subscriptions.manage
Channel accessThis operation changes the target user's live channel subscription. It doesn't change the target user's channel access.
Session stateThe requester's WebSocket connection must be open. The target username must identify a currently connected Radio user in the same Identity Domain.

Request

Send the SUBSCRIBE_USER message as a JSON text message.

NameData typeRequiredDefaultConstraintsDescription
typestringYesNoneMust be SUBSCRIBE_USER.Identifies the user-subscription operation.
targetUserstringConditionalNoneAt least one of targetUser or user is required.Username of the user to subscribe. Use this property for new integrations.
userstringConditionalNoneAt least one of targetUser or user is required.Legacy alias for targetUser.
channelstringConditionalNoneAt least one of channel or channels is required.One channel name.
channelsarray of stringsConditionalNoneAt least one of channel or channels is required.Channel names. Use this property to subscribe the user to one or more channels.

The request must include at least one target selector and at least one channel selector. Use targetUser instead of the legacy user alias. Specify channel for one channel or channels for one or more channels.

{
  "type": "SUBSCRIBE_USER",
  "targetUser": "field-unit-5",
  "channels": [
    "operations",
    "emergency"
  ]
}

Responses

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

Message typeKindDescription
USER_SUBSCRIBEDDirect responseReturns the subscription result for each requested channel.
SUBSCRIBED_BYAsynchronous eventNotifies the target user's connection that another user subscribed it to a channel.
ERRORDenial or errorIndicates a missing target or channel selector, a missing management permission, a target user who isn't connected, or another processing failure.

USER_SUBSCRIBED Response

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

NameData typeRequiredDescription
typestringYesResponse type. The value is USER_SUBSCRIBED.
targetUserstringYesUsername of the target user.
channelsobjectYesMap keyed by channel name. Each value describes the channel subscription result.
channels.*.subscribedbooleanYesWhether the target user is subscribed to the channel.
channels.*.modestringYesChannel mode.
channels.*.clientsSubscribedintegerYesNumber of the target user's connected clients subscribed to the channel.
channels.*.busybooleanYesWhether the channel's talk floor 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.
subscribedBystringNoUsername of the user who requested the subscription.
{
  "type": "USER_SUBSCRIBED",
  "targetUser": "field-unit-5",
  "channels": {
    "operations": {
      "subscribed": true,
      "mode": "normal",
      "clientsSubscribed": 1,
      "busy": false
    }
  },
  "subscribedBy": "dispatcher1"
}

SUBSCRIBED_BY Event

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

NameData typeRequiredDescription
typestringYesEvent type. The value is SUBSCRIBED_BY.
channelstringYesChannel to which the target user's connection was subscribed.
subscribedBystringYesUsername of the user who requested the subscription.
messagestringYesNotification message.
{
  "type": "SUBSCRIBED_BY",
  "channel": "operations",
  "subscribedBy": "dispatcher1",
  "message": "You have been subscribed to channel 'operations' by dispatcher1"
}