client server synchronization ios

16

Upload: make-school

Post on 19-Jan-2017

335 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Client Server Synchronization iOS
Page 2: Client Server Synchronization iOS

CLIENT SERVER SYNCHRONIZATION

Page 3: Client Server Synchronization iOS

AGENDA

Basics of Client Server Synchronization

Synchronization for Trip Planner

Architecture Overview

Page 4: Client Server Synchronization iOS

STRETCH GOAL!

Remember! This step is a stretch goal of the Trip

Planner project. We don’t expect everyone to finish completely.

Page 5: Client Server Synchronization iOS

BASICS OF CLIENT SERVER SYNCHRONIZATION

Page 6: Client Server Synchronization iOS

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

Page 7: Client Server Synchronization iOS

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

Page 8: Client Server Synchronization iOS

DESIGNING THE SYNCHRONIZATION FOR TRIP

PLANNER

Page 9: Client Server Synchronization iOS

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

Page 10: Client Server Synchronization iOS

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

Page 11: Client Server Synchronization iOS

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

Page 12: Client Server Synchronization iOS

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)

Page 13: Client Server Synchronization iOS

ARCHITECTURE OVERVIEW

Page 14: Client Server Synchronization iOS

ARCHITECTURE OVERVIEW

Synchronizer

API Client

Authentication

Core DataClient

Keychain

RemainingApp

Page 15: Client Server Synchronization iOS

ADDITIONAL RESOURCES

Page 16: Client Server Synchronization iOS

ADDITIONAL RESOURCES

Objc.io: Data Synchronization

Objc.io: A Sync Case Study