Brief overview of how PocketSync works
Important: Before using PocketSync, you must first call theinitialize
method to set up the system. The sync process won’t begin automatically - you need to explicitly call thestart
method. Always make sure to set a user identifier withsetUserId
before initiating synchronization.
DatabaseWatcher
detects changes and notifies listeners.DatabaseChangeListener
schedules an upload through SyncScheduler
.SyncScheduler
adds the change to SyncQueue
and debounces multiple changes.SyncWorker
processes the queue:
RemoteChangeListener
is notified of changes via the network client.SyncScheduler
schedules a download by adding a remote change to SyncQueue
.SyncWorker
processes the queue:
ChangeAggregator
optimizes changes before transmission to reduce network usage and improve performance:
SyncScheduler
uses debouncing to reduce the frequency of sync operations: