Use the ably spaces command group to interact with Ably Spaces. These commands enable you to create and manage spaces, track cursors, locations, locks, members, and occupancy.
Spaces management
Use the following commands to create, retrieve, list, and subscribe to Spaces. Spaces enable collaborative features such as member tracking, cursor positions, and component locking:
| Command | Description |
|---|---|
ably spaces create | Initialize a space without entering it. |
ably spaces get | Get the current state of a space. |
ably spaces list | List active spaces. |
ably spaces subscribe | Subscribe to member and location update events in a space. |
Members
Use the following commands to manage members in Spaces. Members represent users who have entered a space and are tracked in real time as they join, leave, or update their status:
| Command | Description |
|---|---|
ably spaces members enter | Enter a space and remain present until terminated. |
ably spaces members get | Get all members in a space. |
ably spaces members subscribe | Subscribe to member presence events in a space. |
Locations
Use the following commands to manage locations in Spaces. Locations track where members are within a collaborative space, enabling you to display which component each member currently has selected:
| Command | Description |
|---|---|
ably spaces locations get | Get all current locations in a space. |
ably spaces locations set | Set location in a space. |
ably spaces locations subscribe | Subscribe to location updates for members in a space. |
Cursors
Use the following commands to manage cursors in Spaces. Cursors track the pointer positions of members in real time, with automatic batching for efficiency:
| Command | Description |
|---|---|
ably spaces cursors get | Get all current cursors in a space. |
ably spaces cursors set | Set a cursor with position data in a space. |
ably spaces cursors subscribe | Subscribe to cursor movements in a space. |
Locks
Use the following commands to manage component locking in Spaces. Locks enable members to optimistically lock UI components before editing them, reducing the risk of conflicting changes:
| Command | Description |
|---|---|
ably spaces locks acquire | Acquire a lock in a space. |
ably spaces locks get | Get a lock or all locks in a space. |
ably spaces locks subscribe | Subscribe to lock events in a space. |
Occupancy
Use the following commands to monitor occupancy in Spaces. Occupancy provides real-time metrics on how many members are currently connected to a space:
| Command | Description |
|---|---|
ably spaces occupancy get | Get current occupancy metrics for a space. |
ably spaces occupancy subscribe | Subscribe to occupancy events on a space. |
See also
- CLI reference — Full list of available commands.