Accessors

  • get connectionState(): ConnectionState
  • Gets the current state of the connection to the server. Multiple sessions might share the same underlying connection. In that case, any connection change is sent to all sessions.

    Data will only be synchronized with the server if this method returns Connected and state() returns Active or Dying.

    Returns ConnectionState

Methods

  • Registers a connection notification on the session object. This will be notified about changes to the underlying connection to the Realm Object Server.

    Parameters

    • callback: ConnectionNotificationCallback

      Called with the following arguments:

      1. newState: The new state of the connection
      2. oldState: The state the connection transitioned from.

    Returns void

    Since

    2.15.0

  • Register a progress notification callback on a session object

    Parameters

    • direction: ProgressDirection

      The progress direction to register for.

    • mode: ProgressMode

      The progress notification mode to use for the registration. Can be either:

      • reportIndefinitely - the registration will stay active until the callback is unregistered
      • forCurrentlyOutstandingWork - the registration will be active until only the currently transferable bytes are synced
    • callback: ProgressNotificationCallback

      Called with the following arguments:

      1. transferred: The current number of bytes already transferred
      2. transferable: The total number of transferable bytes (the number of bytes already transferred plus the number of bytes pending transfer)

    Returns void

    Since

    1.12.0

  • This method returns a promise that does not resolve successfully until all known remote changes have been downloaded and applied to the Realm or the specified timeout is hit in which case it will be rejected. If the method times out, the download will still continue in the background.

    This method cannot be called before the Realm has been opened.

    Parameters

    • Optional timeoutMs: number

      maximum amount of time to wait in milliseconds before the promise will be rejected. If no timeout is specified the method will wait forever.

    Returns Promise<void>

  • Pause a sync session.

    This method is asynchronous so in order to know when the session has started you will need to add a connection notification with addConnectionNotification.

    This method is idempotent so it will be a no-op if the session is already paused or if multiplexing is enabled.

    Returns void

    Since

    2.16.0-rc.2

  • Resumes a sync session that has been paused.

    This method is asynchronous so in order to know when the session has started you will need to add a connection notification with addConnectionNotification.

    This method is idempotent so it will be a no-op if the session is already started or if multiplexing is enabled.

    Returns void

    Since

    2.16.0-rc.2

  • This method returns a promise that does not resolve successfully until all known local changes have been uploaded to the server or the specified timeout is hit in which case it will be rejected. If the method times out, the upload will still continue in the background.

    This method cannot be called before the Realm has been opened.

    Parameters

    • Optional timeoutMs: number

      Maximum amount of time to wait in milliseconds before the promise is rejected. If no timeout is specified the method will wait forever.

    Returns Promise<void>

Generated using TypeDoc