Interface Objects

Enables the Objects to be read, modified and subscribed to for a channel.

Hierarchy

  • Objects

Methods

  • Experimental

    Allows 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 as a single channel message after the batch function has completed.

    This method accepts a synchronous callback, which is provided with a BatchContext object. Use the context object to access Objects on a channel and batch operations for them.

    The objects' data is not modified inside the callback function. Instead, the objects will be updated when the batched operations are applied by the Ably service and echoed back to the client.

    Parameters

    • callback: BatchCallback

      A batch callback function used to group operations together. Cannot be an async function.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

  • Experimental

    Creates a new LiveCounter object instance with the provided count value.

    Parameters

    • Optional count: number

      The initial value for the new LiveCounter object.

    Returns Promise<LiveCounter>

    A promise which, upon success, will be fulfilled with a LiveCounter object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Experimental

    Creates a new LiveMap object instance with the provided entries.

    Type Parameters

    Parameters

    • Optional entries: T

      The initial entries for the new LiveMap object.

    Returns Promise<LiveMap<T>>

    A promise which, upon success, will be fulfilled with a LiveMap object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Experimental

    Retrieves the root LiveMap object for Objects on a channel.

    A type parameter can be provided to describe the structure of the Objects on the channel. By default, it uses types from the globally defined AblyObjectsTypes interface.

    You can specify custom types for Objects by defining a global AblyObjectsTypes interface with a root property that conforms to LiveMapType.

    Example:

    import { LiveCounter } from 'ably';

    type MyRoot = {
    myTypedKey: LiveCounter;
    };

    declare global {
    export interface AblyObjectsTypes {
    root: MyRoot;
    }
    }

    Type Parameters

    Returns Promise<LiveMap<T>>

    A promise which, upon success, will be fulfilled with a LiveMap object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Experimental

    Removes all registrations that match both the specified listener and the specified event.

    Parameters

    Returns void

  • Experimental

    Deregisters all registrations, for all events and listeners.

    Returns void

  • Experimental

    Registers the provided listener for the specified event. If on() is called more than once with the same listener and event, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using on(), and an event is emitted once, the listener would be invoked twice.

    Parameters

    Returns OnObjectsEventResponse

    A OnObjectsEventResponse object that allows the provided listener to be deregistered from future updates.

Generated using TypeDoc