Use the ably spaces locks acquire command to acquire a lock in a space.
Synopsis
ably spaces locks acquire <space-name> <lock-id> [options]Arguments
space-name Required
Required
The name of the space to acquire the lock in.
lock-id Required
Required
The identifier of the lock to acquire.
Options
--data
JSON data to associate with the lock.
--duration | -D
The duration in seconds to hold the lock before automatically releasing it.
--client-id
A client ID to use when acquiring the lock.
--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
Acquire a lock in a space:
ably spaces locks acquire my-space my-lockAcquire a lock with associated data:
ably spaces locks acquire my-space my-lock --data '{"component": "editor"}'Acquire a lock for a specific duration:
ably spaces locks acquire my-space my-lock --duration 300Acquire a lock and output the result in JSON format:
ably spaces locks acquire my-space my-lock-id --jsonSee also
- Spaces — Explore all
ably spacescommands. - CLI reference — Full list of available commands.