Skip to content

Posted Notifications

Andy Johns edited this page Jul 12, 2017 · 7 revisions
Connectivity:

Posted when the Reachability Watcher detects a connectivity state change.

Name: ReachabilityWatcherNotification
Parameters: Array describing current connectivity state.

Possible flags:

  • Offline
  • Online
  • Wifi
  • Cell
  • Authenticated
  • OfflineAuthenticated
  • Internet

Data Download status:

Notification posted when database replication events occur.

Name: DatabaseDownloadNotification
Parameters: Dictionary describing current download state.

  • database: name of the database
  • type: "push" or "pull"
  • totalChangesCount: number of total changes being downloaded/uploaded
  • completedChangesCount: number of changes that have been downloaded/uploaded
  • currentStatus: Possible values: "Stopped" / "Offline" / "Idle" / "Active"
  • lastErrorDescription: Only included if there was an error.
  • lastErrorCode: Only included if there was an error.

Database Changed Notification:

Notification posted when documents change in the database

Name: DatabaseChangedNotification
Parameters: Dictionary describing current changes.

  • documentID : Id of the changed document
  • revisionID : The Id of the newly-added revision. An empty value means the document was purged.
  • inConflict : True if the document is in conflict. (The conflict might pre-date this change.)
  • fromReplication : True if the document change was from replication
  • isDeletion : True if the document is deleted.

Document Changes:

Name: DocumentChangedNotification/docid
Parameters: Dictionary describing the document change.

  • documentID: docid
  • revisionId: the current document revision id
  • isCurrentRevision: Boolean indicating if revisionId is the current revision
  • inConflict: Boolean indicating if the document is currently in a conflict state
  • fromReplication: Boolean indicating if the document change occurred due to a replication update.

Initial Replication Complete:

Name: InitialReplicationCompleteNotification

Posted when the local database has completed it's first replication. After this point, the database is considered up-to-date and it is safe to store and retrieve data.

This notification is only useful for Container observers, not webapps. By the time webapps are started, this notification has already occurred.

Clone this wiki locally