angularjs - Improving mobile aps client server communication efficiency and data availability in offline mode -
my question how store data once received online , still can processed after mobile device got offline and/or restarted. i'm using angularjs ionic (phonegap) building apps. question not explicitly adressing these technologies.
best practices, patterns or algorythms helpful me or useful articles or key words.
1) simple challenge make app more user-friendly making functionality usable not if device online in offline mode. in case implies have make last fetched online data available later use (while device offline , after restarting device!).
2) bit more difficult reduce communication costs synchronizing server side changed data when device reconnects internet.
3) entities can produced on client side while device offline , must synchronized server too. there no potential risks of conflicts because users don't share entities write access.
4) use googles , apples push services inform devices newer entity versions, should updated on client side. polling isn't needed.
client side technologies: javascript, angularjs framework, ionic framework, sqlite (websql) or indexeddb, phonegap (cordova)
server side technologies: java ee, jpa, mysql
data format , communication: json on rest / http, googles , apples push services server-to-client messaging
1) store needed data inside local sqlite database, , pull out when app starts/resumes.
2)in mysql database need table creates new entries when update/change/create content. need store id , timestamp (maybe boolean value if content deleted).
on device make request server send data table , compare locally stored data. if there new id or timestamp has change make new request pull updated data.
3)store created data locally flag isn't synced server. when device goes online again check not synced flags , send data server identifier know device comes , save it.
4)see 2)
you make java script checks every x minutes updated entries , send automatic push notification it. need 2 tables, 1 newest updates , 1 updates got pulled device(just id's , timestamps, not data).
i hope helpful, if new comes mind update answer.
Comments
Post a Comment