 Definitions
 Common Practices
 Offline Data persistent methods
 Available offline data persistence tools
 Persistent Data denotes information that is
infrequently accessed and not likely to be
modified. The opposite of this is dynamic
data (also known as transactional data) where
information is asynchronously changed as
further updates to the information become
available
◦ https://en.wikipedia.org/wiki/Persistent_data
 CRUD - Create, Read, Update and Delete
 Each letter in the acronym can map to a
standard SQL statement and HTTP method:
 Typically we employ CRUD via RESTful APIs
Operation` SQL HTTP
Create INSERT PUT / POST
Read (Retrieve) SELECT GET
Update (Modify) UPDATE PUT / PATCH
Delete (Destroy) DELETE DELETE
Resource POST / create GET / read PUT / update DELETE / delete
/accounts Create a new
account
List accounts Bulk update
accounts
Delete all
accounts
/accounts/123 Error Show account
123
If exists update
account 123
If not error
Delete account
123
/customers Create a new
customer
List customers Bulk update
customers
Delete all
customers
/customers/456 Error Show customer
456
If exists update
customer 456
If not error
Delete customer
456
 Solution: richer clients (using AngularJS ,
ReactJs, and others)
 In browser databases
The Ultimate Solution
will be
Real-time data synchronization
 Failures can happen on: client push, or client
pull/ server push
 Communicate or hide connectivity state
◦ Chat app
 Enable client-side creation and editing features
◦ Todo app
 Disable, modify, or hide features that won’t work
◦ Facebook status, Twitter Tweets
 Notify user about possibly conflicting data (Not
recommended)
 “You are offline”
◦ “Unable to connect to the Internet”
◦ We need to stop treating offline as an error
condition
 Try not to block features completely
◦ If you can’t update, show old data (with message)
◦ Let user create data locally to be sent later
 Dealing with new incoming data. Options:
◦ Show it as the most recent
◦ Show it in chronological order
 Proprietary solution?
◦ Firebase
 Firebase transparently reconnects to server
 Open source local storage databases that sync
◦ Hoodie (Another JS db that syncs. In preview
mode)
◦ remotestorage.io (IETF Proposed Standard)
◦ PouchDB (JavaScript database that syncs!)
 Pros
◦ AngularJS library (AngularFire)
◦ 3-way binding with $bind
◦ Free Developer (Hacker) plan
◦ Paid solution with premium support
◦ Hosted solution
◦ Highly scalable
◦ Can deploy static hosted apps
 Cons
◦ Proprietary solution
◦ Hosted solution (can’t run local or on own servers)
 Pros:
◦ Open Source
◦ Lightweight Cross Browser JavaScript
implementation
◦ Syncs with open source CouchDB protocol servers
 PouchDB-Server - a HTTP on top of PouchDB
 Cloudant - A cluster aware fork of CouchDB
 Couchbase Sync Gateway
 Cons:
◦ I’m biased
Thank You

Offline db

  • 2.
     Definitions  CommonPractices  Offline Data persistent methods  Available offline data persistence tools
  • 3.
     Persistent Datadenotes information that is infrequently accessed and not likely to be modified. The opposite of this is dynamic data (also known as transactional data) where information is asynchronously changed as further updates to the information become available ◦ https://en.wikipedia.org/wiki/Persistent_data
  • 4.
     CRUD -Create, Read, Update and Delete  Each letter in the acronym can map to a standard SQL statement and HTTP method:  Typically we employ CRUD via RESTful APIs Operation` SQL HTTP Create INSERT PUT / POST Read (Retrieve) SELECT GET Update (Modify) UPDATE PUT / PATCH Delete (Destroy) DELETE DELETE
  • 5.
    Resource POST /create GET / read PUT / update DELETE / delete /accounts Create a new account List accounts Bulk update accounts Delete all accounts /accounts/123 Error Show account 123 If exists update account 123 If not error Delete account 123 /customers Create a new customer List customers Bulk update customers Delete all customers /customers/456 Error Show customer 456 If exists update customer 456 If not error Delete customer 456
  • 7.
     Solution: richerclients (using AngularJS , ReactJs, and others)  In browser databases
  • 8.
    The Ultimate Solution willbe Real-time data synchronization
  • 9.
     Failures canhappen on: client push, or client pull/ server push  Communicate or hide connectivity state ◦ Chat app  Enable client-side creation and editing features ◦ Todo app  Disable, modify, or hide features that won’t work ◦ Facebook status, Twitter Tweets  Notify user about possibly conflicting data (Not recommended)
  • 10.
     “You areoffline” ◦ “Unable to connect to the Internet” ◦ We need to stop treating offline as an error condition  Try not to block features completely ◦ If you can’t update, show old data (with message) ◦ Let user create data locally to be sent later  Dealing with new incoming data. Options: ◦ Show it as the most recent ◦ Show it in chronological order
  • 11.
     Proprietary solution? ◦Firebase  Firebase transparently reconnects to server  Open source local storage databases that sync ◦ Hoodie (Another JS db that syncs. In preview mode) ◦ remotestorage.io (IETF Proposed Standard) ◦ PouchDB (JavaScript database that syncs!)
  • 12.
     Pros ◦ AngularJSlibrary (AngularFire) ◦ 3-way binding with $bind ◦ Free Developer (Hacker) plan ◦ Paid solution with premium support ◦ Hosted solution ◦ Highly scalable ◦ Can deploy static hosted apps  Cons ◦ Proprietary solution ◦ Hosted solution (can’t run local or on own servers)
  • 14.
     Pros: ◦ OpenSource ◦ Lightweight Cross Browser JavaScript implementation ◦ Syncs with open source CouchDB protocol servers  PouchDB-Server - a HTTP on top of PouchDB  Cloudant - A cluster aware fork of CouchDB  Couchbase Sync Gateway  Cons: ◦ I’m biased
  • 16.