What is Spaces?

Spaces enables you to build collaborative environments in your application.

Building realtime collaborative applications requires managing two different states; participant state and application state. Both states involve different types of data, and that data is handled differently.

Participant state is the data related to the members collaborating synchronously in an application, such as their online status, their locations and the positions of their cursors. Application state is the data related to the application itself, such as the data in a cell or field, or the description and status of a task.

The requirements in how realtime updates are managed vary between the two different states. Participant state is largely ephemeral and usually doesn’t need to be stored or retained. Application state must be sent to your backend servers, validated and then stored in your database.

Ably’s Spaces provides high-level APIs for managing the participant state of your application. Each API is optimized based on the payload structure and frequency of updates that are anticipated for that feature. Ably’s Pub/Sub product provides flexible APIs to manage application state in realtime by enabling communication between your frontend and backend systems, as well as third-party services.

Spaces is powered by a separate SDK that is built on top of Ably’s JavaScript SDK. Use cases include adding live cursors to an interactive whiteboard, building an avatar stack for an application to show who is online, and displaying which UI components users have selected and which ones are locked for editing to avoid conflicts.

Whether you’re adding realtime collaborative capabilities to an existing application, or building a new application from scratch, the Spaces SDK enables you to quickly and easily implement the following features:

Space
a virtual area of your application in which realtime collaboration between users can take place.
Avatar stack
the most common way of showing the online status of users in an application.
Member locations
a way to track where users are to see which part of your application they’re interacting with, such as a cell or form field.
Live cursors
a way to efficiently track the cursor positions of users in realtime.
Component locking
a way to optimistically lock stateful UI components before letting users edit them.

There are several benefits provided by the fact that the Spaces SDK is built on top of the Ably JavaScript SDK:

The following are a selection of additional features that can be built using Ably Pub/Sub to further enhance your collaborative applications:

  • Chat
  • Comments and annotations
  • Typing indicators
  • Reactions
  • Notifications
  • ‘Follow me’ and ‘bring to me’ functionality

Use the multiplayer reference guide for guidance on how to build each of these features with Ably.

Spaces is in public beta so that you can explore its capabilities. Your feedback will help prioritize improvements and fixes in a subsequent release. The features have been validated for a set of use-cases and are stable and perform well, but API changes may occur that impact functionality. The beta is implemented to work under real-world situations and load, but you should use caution when deciding under what conditions to use it.

Spaces SDK