Use the ably channels occupancy subscribe command to subscribe to occupancy updates on an Ably Pub/Sub channel.
Synopsis
ably channels occupancy subscribe <channel-name> [options]Arguments
channel-name Required
Required
The name of the channel to subscribe to occupancy updates on.
Options
--duration | -D
The duration in seconds to subscribe for before automatically unsubscribing.
--client-id
A client ID to use when subscribing.
--json
Output results as compact JSON. Mutually exclusive with --pretty-json.
--pretty-json
Output results in formatted JSON. Mutually exclusive with --json.
--verbose | -v
Enable verbose logging. Can be combined with --json or --pretty-json.
Examples
Subscribe to occupancy updates:
ably channels occupancy subscribe my-channelSubscribe for a specific duration:
ably channels occupancy subscribe my-channel --duration 60Subscribe to occupancy using an API key environment variable:
ABLY_API_KEY="YOUR_API_KEY" ably channels occupancy subscribe my-channelSubscribe to occupancy updates in JSON format:
ably channels occupancy subscribe my-channel --jsonSubscribe to occupancy updates in formatted JSON:
ably channels occupancy subscribe my-channel --pretty-jsonSee also
- Channels — Explore all
ably channelscommands. - CLI reference — Full list of available commands.