Batch multiple operations together using a batch context, which wraps the underlying PathObject or Instance from which the batch was called. The batch context always contains a resolved instance, even when called from a PathObject. If an instance cannot be resolved from the referenced path, or if the instance is not a LiveObject, this method throws an error.
Batching enables you to group multiple operations together and send them to the Ably service in a single channel message. As a result, other clients will receive the changes in a single channel message once the batch function has completed.
The objects' data is not modified inside the batch function. The batched operations are sent to Ably and, once accepted, applied locally. The returned promise resolves after all operations have been applied.
A synchronous function that receives a BatchContext used to group operations together.
A promise which resolves after all batched operations have been accepted by Ably and applied locally, or rejects with an ErrorInfo object upon failure.
Sends an operation to the Ably system to remove a key from a given LiveMapInstance, or from the map instance resolved from the path when using LiveMapPathObject.
If called via LiveMapInstance and the underlying instance at runtime is not a map, or if called via LiveMapPathObject and the map instance at the specified path cannot be resolved at the time of the call, this method throws an error.
The operation is sent to Ably and, once accepted, applied locally. The returned promise resolves after the operation has been applied.
The key to remove.
A promise which resolves after the operation has been accepted by Ably and applied locally, or rejects with an ErrorInfo object upon failure.
Sends an operation to the Ably system to set a key to a specified value on a given LiveMapInstance, or on the map instance resolved from the path when using LiveMapPathObject.
If called via LiveMapInstance and the underlying instance at runtime is not a map, or if called via LiveMapPathObject and the map instance at the specified path cannot be resolved at the time of the call, this method throws an error.
The operation is sent to Ably and, once accepted, applied locally. The returned promise resolves after the operation has been applied.
The key to set the value for.
The value to assign to the key.
A promise which resolves after the operation has been accepted by Ably and applied locally, or rejects with an ErrorInfo object upon failure.
Generated using TypeDoc
Defines operations available on LiveMap objects.