6. BASICS OF CLIENT SERVER
SYNCHRONIZATION
Main Goal: Client and server should (almost always)
have the same data
Changes from the client need to be sent to the server
Client needs to check server for updated information
frequently
7. TRACKING UNSYNCED
CLIENT CHANGES
Changes to local data need to be tracked - need to
remember which data has been sent to server
successfully and which not
Need to track new, updated and deleted data
9. TRACKING UNSYNCED
CLIENT CHANGES
Potential solution:
• using a lastUpdate timestamp to check which objects
changed since last server sync
• using a serverIdentifier to store server ID and to
check which objects are new locally
• keep a list of deleted objects that need to be synced
10. SYNCING CHANGES TO THE
SERVER
Find all:
• Objects that updated since last synchronization
• Objects that have been created since last
synchronization
• Deletions that haven’t been synchronized yet
→ Generate network request(s) to sync these changes
11. SYNCING CHANGES FROM
THE SERVER
Download trips from the server:
• find trips that exist locally, with server identifier but
don’t exist on server → delete them
• find trips that exist locally and are different in
server response → compare which entry is newer
and potentially update local trip
12. ADVANCED APPROACH
Instead of downloading all trips from server, only
download the ones the client doesn’t know about yet
(this is beyond the scope of the project)