Spaces

Open in

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:

CommandDescription
ably spaces createInitialize a space without entering it.
ably spaces getGet the current state of a space.
ably spaces listList active spaces.
ably spaces subscribeSubscribe 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:

CommandDescription
ably spaces members enterEnter a space and remain present until terminated.
ably spaces members getGet all members in a space.
ably spaces members subscribeSubscribe 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:

CommandDescription
ably spaces locations getGet all current locations in a space.
ably spaces locations setSet location in a space.
ably spaces locations subscribeSubscribe 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:

CommandDescription
ably spaces cursors getGet all current cursors in a space.
ably spaces cursors setSet a cursor with position data in a space.
ably spaces cursors subscribeSubscribe 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:

CommandDescription
ably spaces locks acquireAcquire a lock in a space.
ably spaces locks getGet a lock or all locks in a space.
ably spaces locks subscribeSubscribe 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:

CommandDescription
ably spaces occupancy getGet current occupancy metrics for a space.
ably spaces occupancy subscribeSubscribe to occupancy events on a space.

See also