Constructors

Properties

downloadBeforeOpenBehavior: Readonly<OpenRealmBehaviorConfiguration> = ...

The default behavior settings if you want to wait for downloading a synchronized Realm to complete before opening it.

Deprecated

since v12

openLocalRealmBehavior: Readonly<OpenRealmBehaviorConfiguration> = ...

The default behavior settings if you want to open a synchronized Realm immediately and start working on it. If this is the first time you open the Realm, it will be empty while the server data is being downloaded in the background.

Deprecated

since v12

Methods

  • Enable multiplexing multiple sync sessions over a single connection for a Realm app. When having a lot of synchronized realms open the system might run out of file descriptors because of all the open sockets to the server. Session multiplexing is designed to alleviate that, but it might not work with a server configured with fail-over. Only use if you're seeing errors about reaching the file descriptor limit and you know you are using many sync sessions.

    Returns void

  • Initiate a client reset. The Realm must be closed prior to the reset.

    A synced Realm may need to be reset if the communications with the Atlas Device Sync Server indicate an unrecoverable error that prevents continuing with normal synchronization. The most common reason for this is if a client has been disconnected for too long.

    The local copy of the Realm is moved into a recovery directory for safekeeping.

    Local writes that were not successfully synchronized to Atlas will be present in the local recovery copy of the Realm file. The re-downloaded Realm will initially contain only the data present at the time the Realm was synchronized up on the server.

    Parameters

    Returns void

    Deprecated

    Throws

    An Error if reset is not possible.

    Example

    {
    * // Once you have opened your Realm, you will have to keep a reference to it.
    * // In the error handler, this reference is called `realm`
    * const config = {
    * // schema, etc.
    * sync: {
    * user,
    * partitionValue,
    * error: (session, error) => {
    * if (error.name === 'ClientReset') {
    * let path = realm.path; // realm.path will no be accessible after realm.close()
    * realm.close();
    * Realm.App.Sync.initiateClientReset(app, path);
    * // - open Realm at `error.config.path` (oldRealm)
    * // - open Realm with `config` (newRealm)
    * // - copy required objects from oldRealm to newRealm
    * // - close both Realms
    * }
    * }
    * }
    * };
    * }

Generated using TypeDoc