API v 1.2

Channel Metadata

Channel Metadata provides information about channels, such as the current state changes of a channel, or the changes in its occupancy. There are several ways to obtain channel metadata:

  1. Metachannels – Metachannels are special channels that carry metadata events about all activity associated with an Ably application, which includes metadata associated with channel and connection lifecycle.
  2. Inband channel occupancy events – Inband occupancy events are occupancy events relating to a channel that are delivered within the channel itself.
  3. Channel Status API – The Channel Status API is a REST API that allows users to query a channel to retrieve channel metadata. It also allows you to enumerate all the active channels in a particular app. The details of the Channel Status API are covered in the Channel Status documentation.
  4. Integration rules – Integration rules allow events within Ably to be pushed to targets such as AWS Lambda or Kinesis, webhook URLs, and so on. The choice of event sources includes channel lifecycle and channel occupancy events.

Having access to channel metadata can provide numerous benefits. For example, if you want subscribers to be able to track how many other clients are attached to the same channel, and don’t need any of the other features of presence such as being able to enumerate them all and view their presence data, inband occupancy metrics give a simple and lightweight way to do this. Since occupancy is just a simple count of members, this avoids the 200 presence member limit that Ably imposes to prevent presence updates from overwhelming the channel with presence updates.

You may want to publish your data only if there is a subscriber for that data. The channel lifecycle events on metachannels can notify you when a channel is opened, becomes active, or is no longer active, indicating to publisher clients when the last subscriber leaves the channel.

If you need to be able to query channel metadata, you can also make use of the Channel Status API to inspect the state of individual channels, or enumerate all active channels in an app. This is a REST API intended for occasional queries; if you need realtime updates, rather than using a polling approach, Ably recommends you use our realtime metadata APIs.

The tutorials provide step-by-step examples of how to obtain and use channel metadata:

View Channel Metadata API Reference.