Synchronization
LiveObjects provides a powerful synchronization mechanism to ensure that all clients see the same data. This document explains how synchronization works in LiveObjects.
Channel Objects
Ably maintains the authoritative state of all objects on each channel across its distributed infrastructure.
Each object instance is identified by a unique object ID . The channel holds the complete up-to-date data of all objects on the channel.
Ably stores the object data durably such that the data is available even after the channel becomes inactive. The data is stored in multiple regional datacenters and across multiple availability zones. This ensures that the data is available even if there is disruption in one or more datacenters.
When a channel first becomes active in a region, the channel loads the object data from durable storage into memory to facilitate low-latency operation processing.
Client Objects
While Ably maintains the source of truth on the channel, each connected client keeps a local representation of the objects on the channel.
When the client first attaches to the channel, the state of the channel objects is streamed to the client. Lifecycle events allow your application to be notified when the local state is being synchronized with the Ably service.
All object operations published to the channel are broadcast to subscribed clients, which apply the operations to their local client objects when they are received. This allows clients to maintain a consistent view of the channel objects in a bandwidth-efficient way, since only the operations (rather than the updated objects themselves) are sent over the client’s connection.
If there is a loss of continuity on the channel for any reason, such as the client becoming disconnected for more than two minutes and entering the suspended state , the client objects will automatically be resynchronized when it reconnects.