Unsubscribing from an Oracle Radio WebSocket Channel
Send an UNSUBSCRIBE message to remove the current Radio WebSocket connection from one or more channels.
Permissions and Prerequisites
The following permissions and prerequisites apply to this operation.
| Requirement | Value |
|---|---|
| Authentication | Complete the supported authentication path for the client before sending this operation. See authentication. |
| Radio permission | No operation-specific Radio permission is defined for this message. |
| Channel access | The operation applies to the current connection's live memberships. A user can't unsubscribe from the user's personal channel. |
| Session state | The WebSocket connection must be open. The connection can request only its own unsubscription. |
Note
The contract doesn't define whether this operation changes a separately saved subscription or how subscription state is restored after reconnecting.
The contract doesn't define whether this operation changes a separately saved subscription or how subscription state is restored after reconnecting.
Request
Send the UNSUBSCRIBE message as a JSON text message. Use channels for one or more channel names.
| Name | Data type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
type | string | Yes | None | Must be UNSUBSCRIBE. | Identifies the channel-unsubscribe operation. |
channel | string | No | None | Single channel name. | Channel to leave when requesting one channel. |
channels | array of strings | No | None | Channel names. | Channels to leave. |
Note
The contract defines both
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": "UNSUBSCRIBE",
"channels": ["operations"]
}
Responses
The following table lists the messages the client can receive and explains their purpose.
| Message type | Kind | Description |
|---|---|---|
UNSUBSCRIBED | Direct response | Reports the result for each requested channel. A result can explain why a channel wasn't left. |
ERROR | Denial or error | Indicates a missing channel list, identity-domain failure, invalid request, or processing failure. |
UNSUBSCRIBED Response
The following table describes the response properties, their data types, and whether they are required.
| Name | Data type | Required | Description |
|---|---|---|---|
type | string | Yes | Response type. The value is UNSUBSCRIBED. |
channels | object | Yes | Result keyed by requested channel name. |
channels.*.unsubscribed | boolean | No | Whether the connection left the channel. |
channels.*.denied | boolean | No | Whether the request was denied. |
channels.*.reason | string | No | Reason the connection didn't leave the channel. |
channel | string | No | Channel for a single-channel request. |
unsubscribed | boolean | No | Result for a single-channel request. |
reason | string | No | Failure reason for a single-channel request. |
warning | string | No | Warning when some requested channels couldn't be left. |
{
"type": "UNSUBSCRIBED",
"channels": {
"operations": {
"unsubscribed": true
}
},
"channel": "operations",
"unsubscribed": true
}