Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions src/data/nav/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,13 +626,41 @@ export default {
},
],
},
{
name: 'REST interface',
pages: [
{ name: 'REST client', link: '/docs/pub-sub/api/javascript/rest/rest-client' },
{ name: 'Auth', link: '/docs/pub-sub/api/javascript/rest/auth' },
{ name: 'Crypto', link: '/docs/pub-sub/api/javascript/rest/crypto' },
{
name: 'Channels and messages',
pages: [
{ name: 'Channels', link: '/docs/pub-sub/api/javascript/rest/channels' },
{ name: 'Channel', link: '/docs/pub-sub/api/javascript/rest/channel' },
{ name: 'ChannelDetails', link: '/docs/pub-sub/api/javascript/rest/channel-details' },
{ name: 'Message', link: '/docs/pub-sub/api/javascript/rest/message' },
{ name: 'RestAnnotations', link: '/docs/pub-sub/api/javascript/rest/rest-annotations' },
],
},
{
name: 'Presence',
pages: [
{ name: 'Presence', link: '/docs/pub-sub/api/javascript/rest/presence' },
{ name: 'PresenceMessage', link: '/docs/pub-sub/api/javascript/rest/presence-message' },
],
},
{
name: 'Push notifications',
pages: [
{ name: 'Push', link: '/docs/pub-sub/api/javascript/rest/push' },
{ name: 'PushChannel', link: '/docs/pub-sub/api/javascript/rest/push-channel' },
{ name: 'PushAdmin', link: '/docs/pub-sub/api/javascript/rest/push-admin' },
],
},
],
},
],
},
{
link: 'https://ably.com/docs/sdk/js/v2.0/',
name: 'JavaScript SDK (TypeDoc)',
external: true,
},
],
},
],
Expand Down
276 changes: 276 additions & 0 deletions src/pages/docs/pub-sub/api/javascript/rest/auth.mdx

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions src/pages/docs/pub-sub/api/javascript/rest/channel-details.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: ChannelDetails
meta_description: "API reference for channel metadata (ChannelDetails) in the Ably Pub/Sub JavaScript REST SDK."
meta_keywords: "Ably Pub/Sub SDK, JavaScript, channel metadata, ChannelDetails, ChannelStatus, occupancy, metrics, status"
---

Channel metadata describes the current state of a channel, including whether it is active and its [occupancy](/docs/presence-occupancy/occupancy) metrics. It is represented by the `ChannelDetails` type, which a [`Channel`](/docs/pub-sub/api/javascript/rest/channel) returns from its [`status()`](/docs/pub-sub/api/javascript/rest/channel#status) method.

<Code>
```javascript
const channel = rest.channels.get('{{RANDOM_CHANNEL_NAME}}');
const details = await channel.status();
console.log(details.channelId, details.status.occupancy.metrics.connections);
```
</Code>

## ChannelDetails <a id="ChannelDetails"/>

A `ChannelDetails` object contains information about a channel, along with its current state in a `ChannelStatus` object.

<Table id='ChannelDetailsProperties'>

| Property | Description | Type |
| --- | --- | --- |
| channelId | The name of the channel, including any qualifier. | String |
| status | The current state of the channel. | <Table id='ChannelStatus'/> |

</Table>

<Table id='ChannelStatus' hidden>

| Property | Description | Type |
| --- | --- | --- |
| isActive | Whether the channel is active. For events indicating regional activity, this reflects activity in that region rather than global activity. | Boolean |
| occupancy | The occupancy of the channel. For events indicating regional activity, this reflects activity in that region rather than global activity. | <Table id='ChannelOccupancy'/> |

</Table>

<Table id='ChannelOccupancy' hidden>

| Property | Description | Type |
| --- | --- | --- |
| metrics | The occupancy metrics for the channel. | <Table id='ChannelMetrics'/> |

</Table>

<Table id='ChannelMetrics' hidden>

| Property | Description | Type |
| --- | --- | --- |
| connections | The number of connections attached to the channel. | Number |
| publishers | The number of connections attached to the channel that are authorized to publish. | Number |
| subscribers | The number of connections attached that are authorized to subscribe to messages. | Number |
| presenceConnections | The number of connections that are authorized to enter members into the presence set. | Number |
| presenceMembers | The number of members currently entered into the presence set. | Number |
| presenceSubscribers | The number of connections that are authorized to subscribe to presence messages. | Number |

</Table>

## Example

The following is an example of a `ChannelDetails` payload:

<Code>
```json
{
"channelId": "foo",
"status": {
"isActive": true,
"occupancy": {
"metrics": {
"connections": 1,
"publishers": 1,
"subscribers": 1,
"presenceConnections": 1,
"presenceMembers": 0,
"presenceSubscribers": 1
}
}
}
}
```
</Code>
Loading