Use the ably apps rules create command to create a new channel rule for an Ably application. Channel rules define behavior for channels matching a specific namespace.
Synopsis
ably apps rules create <rule-name> [options]Arguments
rule-name Required
The name of the channel rule to create. The name defines the namespace that matching channels belong to.
Options
--app
The app ID to create the rule for. Uses the currently selected app if not specified.
--persisted
Enable message persistence for matching channels. Defaults to false.
--push-enabled
Enable push notifications for matching channels. Defaults to false.
--authenticated
Require authentication for operations on matching channels.
--tls-only
Restrict matching channels to TLS connections only.
--persist-last
Persist only the last message on matching channels.
--populate-channel-registry
Populate the channel registry for matching channels, enabling channel enumeration.
--mutable-messages
Enable message update and delete functionality on matching channels. Enabling this option automatically enables message persistence.
--batching-enabled
Enable message batching for matching channels.
--batching-interval
The batching interval in milliseconds for matching channels. Only applicable when --batching-enabled is set.
--conflation-enabled
Enable message conflation for matching channels.
--conflation-interval
The conflation interval in milliseconds for matching channels. Only applicable when --conflation-enabled is set.
--conflation-key
The conflation key for matching channels. Only applicable when --conflation-enabled is set.
--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
Create a channel rule with message persistence enabled:
ably apps rules create "chat" --persistedCreate a channel rule with mutable messages enabled:
ably apps rules create "chat" --mutable-messagesCreate a channel rule with push notifications enabled:
ably apps rules create "events" --push-enabledCreate a channel rule with persistence and push notifications for a specific app:
ably apps rules create "notifications" --persisted --push-enabled --app "My App"Create a channel rule and output the result in JSON format:
ably apps rules create "chat" --persisted --jsonSee also
- Apps — Explore all
ably appscommands. - CLI reference — Full list of available commands.