Ditto JS SDK v5.1.0
    Preparing search index...

    Class SyncSubscription

    A sync subscription configures Ditto to receive updates from remote peers about documents matching the subscription's query.

    The sync subscription will remain active until it is cancelled, or the Ditto instance managing the subscription has been closed.

    Create a sync subscription by calling ditto.sync.registerSubscription().

    Index

    Properties

    ditto: Ditto

    The Ditto instance this sync subscription belongs to.

    Accessors

    • get isCancelled(): boolean

      true when the sync subscription has been cancelled or the Ditto instance managing this subscription has been closed.

      Returns boolean

    • get queryArguments(): Readonly<any>

      The query arguments of the sync subscription (as passed while registering it).

      Note that this value is not guaranteed to be strictly equal to the value used when registering the sync subscription. In particular, any Attachment values in query arguments will be represented by that attachment's attachment token here.

      Also see queryArgumentsCBORData and queryArgumentsJSONString for the raw serialized representations of the query arguments.

      Returns Readonly<any>

    • get queryArgumentsCBORData(): Uint8Array<ArrayBufferLike>

      The query arguments of the sync subscription, serialized as CBOR (as passed while registering it).

      Note that any Attachment values passed in as query arguments when creating this sync subscription will be represented by a serialized version of that attachment.

      Returns Uint8Array<ArrayBufferLike>

    • get queryArgumentsJSONString(): string

      The query arguments of the sync subscription, serialized as JSON (as passed while registering it).

      Note that any Attachment values passed in as query arguments when creating this sync subscription will be represented by a serialized version of that attachment.

      Returns string

    • get queryString(): string

      The query string of the sync subscription (as passed while registering it).

      This is the original query string supplied to ditto.sync.registerSubscription(), not the resolved query with queryArguments substituted in.

      Returns string

    Methods

    • Enables TS 5.2+ using syntax to cancel the subscription at scope exit instead of waiting for FinalizationRegistry (which is best-effort on Node/Web and 10s-polled / leaky on older React Native versions).

      Returns void

    • Cancels the sync subscription and unregisters it. No-op if the sync subscription has already been cancelled or the Ditto instance managing this subscription has been closed.

      Returns void