Occupancy provides high level metrics about the clients attached to a channel. This includes the number of connections currently attached to a channel, and the number of connections attached that are permitted to publish and subscribe to the channel.
The following are the metric categories that occupancy reports:
- the number of connections
- the number of connections that are authorized to publish
- the number of connections that are authorized to subscribe to messages
- the number of connections that are authorized to subscribe to presence messages
- the number of connections that are authorized to enter members into the presence channel
- the number of members currently entered into the presence channel
Details of a channel’s occupancy are returned in the
metrics property of a payload.
If occupancy is returned as a
[meta]occupancy event when subscribing to a channel using the occupancy channel option, then
metrics is part of the
data property. The following is an example of a
Occupancy can be retrieved in the following ways:
- In realtime, by subscribing to a channel with the
- For a single channel using a REST request
- “Enumerating all active channels”#one-off-requests in an app
- Configure a
channel.occupancyrule source to send occupancy events to an external target, such as AWS Lambda or a webhook
occupancy channel option enables a client to subscribe to occupancy events related to a channel. Events are delivered to the client as messages on the channel.
Occupancy can be queried via REST in the following ways:
- Query a single channel to return its
ChannelDetails, including its occupancy
- Enumerate a list of active channels in an app, including the occupancy of each
Integration rules can be configured with
channel.occupancy set as a rule source. Occupancy events that occur on the selected channels will be pushed to external targets, such as AWS Lambda, or custom webhook endpoints.