|
| 1 | +--- |
| 2 | +title: Channel Metadata |
| 3 | +meta_description: "Realtime Client Library SDK API reference section for channel metadata." |
| 4 | +meta_keywords: "Ably, Ably realtime, API Reference, Realtime SDK, channel, metadata, channel metadata, occupancy" |
| 5 | +redirect_from: |
| 6 | + - /docs/api/versions/v1.1/realtime-sdk/channel-metadata |
| 7 | + - /docs/api/versions/v1.0/realtime-sdk/channel-metadata |
| 8 | +--- |
| 9 | + |
| 10 | +## Types <a id="types" /> |
| 11 | + |
| 12 | +The payload of metadata events for channels is the [`ChannelDetails`](#channel-details) type which contains the `channelId` and other static information about the channel, plus a `status` containing a [`ChannelStatus`](#channel-status) instance which contains information about the current state of the channel. |
| 13 | + |
| 14 | +### ChannelDetails <a id="channel-details" /> |
| 15 | + |
| 16 | +`ChannelDetails` is an object returned when requesting or receiving [channel metadata](/docs/metadata-stats/metadata). It contains information on the channel itself, along with the current state of the channel in the [ChannelStatus](#channel-status) object. |
| 17 | + |
| 18 | +| Name | Description | Type | |
| 19 | +|------|-------------|------| |
| 20 | +| channelId | the required name of the channel including any qualifier, if any | `string` | |
| 21 | +| region | in events relating to the activity of a channel in a specific region, this optionally identifies the region | `string` | |
| 22 | +| isGlobalMaster | in events relating to the activity of a channel in a specific region, this optionally identifies whether or not that region is responsible for global coordination of the channel | `boolean` | |
| 23 | +| status | an optional [`ChannelStatus`](#channel-status) instance | [`ChannelStatus`](#channel-status) | |
| 24 | + |
| 25 | +The following is an example of a `ChannelDetails` JSON object: |
| 26 | + |
| 27 | +<Code> |
| 28 | +```json |
| 29 | +{ |
| 30 | + "channelId": "foo", |
| 31 | + "status": { |
| 32 | + "isActive": true, |
| 33 | + "occupancy": { |
| 34 | + "metrics": { |
| 35 | + "connections": 1, |
| 36 | + "publishers": 1, |
| 37 | + "subscribers": 1, |
| 38 | + "presenceConnections": 1, |
| 39 | + "presenceMembers": 0, |
| 40 | + "presenceSubscribers": 1, |
| 41 | + "objectPublishers": 1, |
| 42 | + "objectSubscribers": 1 |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | +</Code> |
| 49 | + |
| 50 | +### ChannelDetails.ChannelStatus <a id="channel-status" /> |
| 51 | + |
| 52 | +`ChannelStatus` is contained within the [`ChannelDetails`](#channel-details) object, and optionally contains an [Occupancy](#occupancy) object. |
| 53 | + |
| 54 | +| Name | Description | Type | |
| 55 | +|------|-------------|------| |
| 56 | +| isActive | a required boolean value indicating whether the channel that is the subject of the event is active. For events indicating regional activity of a channel this indicates activity in that region, not global activity | `boolean` | |
| 57 | +| occupancy | an optional [`Occupancy`](#occupancy) instance indicating the occupancy of the channel. For events indicating regional activity of a channel this indicates activity in that region, not global activity. | [`Occupancy`](#occupancy) | |
| 58 | + |
| 59 | +### ChannelDetails.ChannelStatus.Occupancy <a id="occupancy" /> |
| 60 | + |
| 61 | +Occupancy is optionally contained within the [`ChannelStatus`](#channel-status) object, and contains metadata relating to the occupants of the channel. This is usually contained within the `occupancy` attribute of the [`ChannelStatus`](#channel-status) object. |
| 62 | + |
| 63 | +The `occupancy` attribute contains the `metrics` attribute, which contains the following members: |
| 64 | + |
| 65 | +| Name | Description | Type | |
| 66 | +|------|-------------|------| |
| 67 | +| connections | the number of connections | `integer` | |
| 68 | +| publishers | the number of connections attached to the channel that are authorised to publish | `integer` | |
| 69 | +| subscribers | the number of connections attached that are authorised to subscribe to messages | `integer` | |
| 70 | +| presenceSubscribers | the number of connections that are authorised to subscribe to presence messages | `integer` | |
| 71 | +| presenceConnections | the number of connections that are authorised to enter members into the presence channel | `integer` | |
| 72 | +| presenceMembers | the number of members currently entered into the presence channel | `integer` | |
| 73 | +| objectPublishers | the number of connections that are authorised to publish updates to objects on the channel | `integer` | |
| 74 | +| objectSubscribers | the number of connections that are authorised to subscribe to objects on the channel | `integer` | |
0 commit comments