About LiveObjects

Ably LiveObjects enables effortless realtime synchronization of application state across multiple users and devices at any scale. LiveObjects provides a set of purpose-built APIs and data structures to handle the complexities of persisting and synchronizing state, freeing you to focus on building features instead of managing concurrency or conflict resolution.

LiveObjects enables you to store data as “objects” on a channel. These objects are automatically synchronized in realtime across all connected clients, and any conflicts that arise from concurrent updates are seamlessly resolved in the background.

LiveObjects is managed and persisted on a per-channel basis and benefit from the same performance guarantees and scaling potential as channels.

The LiveObjects API is available as a feature of channels within the Ably Pub/Sub SDK and can be accessed via the channel.objects property.

Ably LiveObjects is useful when your application has data that:

  • Is shared by many users
  • Needs to be synchronized in realtime
  • Can be updated concurrently by many users

Use Ably LiveObjects to build scalable realtime applications such as:

  • Voting and polling systems: Platforms that need the ability to count and display votes in realtime, such as audience engagement tools, quizzes, and decision-making applications.
  • Collaborative applications: Tools like shared whiteboards or content and product management applications where multiple users edit shared content simultaneously.
  • Live leaderboards: Multiplayer games or competition-based applications that require up-to-date rankings and scoreboards.
  • Game state: Applications that present dynamic in-game statistics or game state in realtime, such as player health, scores, and inventory changes.
  • Shared configuration, settings or controls: Systems where configuration parameters are shared or updated across multiple users or devices.

Ably LiveObjects provides the following key features:

LiveCounter is a numerical counter that supports increment and decrement operations. It ensures that all updates are correctly applied and synchronized across users in realtime, preventing inconsistencies when multiple users modify the counter value simultaneously.

LiveCounter is ideal for scenarios such as:

  • Tracking reactions (likes, upvotes, or downvotes) in social applications.
  • Counting active users in a chatroom.
  • Maintaining live leaderboard scores in competitive applications.

LiveMap is a key/value data structure that synchronizes its state across users in realtime. It enables you to store primitive values, such as numbers, strings, booleans and buffers, as well as other objects, enabling composable data structures.

Conflicts in a LiveMap are automatically resolved with last-write-wins (LWW) semantics.

A LiveMap can store references to other LiveMap or LiveCounter objects as values for its keys, enabling you to build complex, hierarchical object structure. This enables you to represent complex data models in your applications while ensuring realtime synchronization across clients.

Batching enables multiple LiveObjects operations to be grouped into a single channel message, ensuring atomic application of grouped operations. This prevents partial updates of your data and ensures consistency across all users.

Batching is particularly useful in scenarios where multiple dependent updates need to be processed together, ensuring a seamless experience for users.