Events

Realm event recording can be used to record all reads and writes performed on a Realm and report them to the server. Enable event recording by setting the eventConfiguration property of the Realm.Configuration used to open a Realm, and then obtain an Events instance with the events property on the Realm.

  • Begin recording events with the given activity name.

    All queries run and all objects instantiated within an event scope will be automatically reported as ‘read’ events when the scope is ended. All objects modified within an event scope will produce ‘write’ events which report the initial state of the object and the new values of all properties which changed.

  • End recording the current event scope and report all generated events.

    This function saves the events to disk locally and then asynchronously sends them to the server. The optional completion function is called when the event data has been successfully persisted, and not when the actual upload has completed.

    Calls to this function must be paired with calls to beginScope() and an exception will be thrown if no scope is currently active.

  • Record a custom event.

    This function saves the event to disk locally and then asynchronously sends them to the server. The optional completion function is called when the event data has been successfully persisted, and not when the actual upload has completed.

    This function does not interact with event scopes, and can be called with no active scope.

  • Replace the metadata supplied in the event configuration with new values.

    If called while an event scope is active, the new metadata will not be used until the next event scope is begun.

    See EventConfiguration.metadata for more details on event metdata.