Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Data: online and off

8ec1383b240b5ba15ffb9743fceb3c0e?s=47 Phil Nash
September 21, 2015

Data: online and off

8ec1383b240b5ba15ffb9743fceb3c0e?s=128

Phil Nash

September 21, 2015
Tweet

Transcript

  1. DATA: ONLINE AND OFF

  2. Phil Nash @philnash http:/ /philna.sh philnash@twilio.com

  3. DATA: ONLINE AND OFF

  4. OFFLINE FIRST

  5. Offline first An application that treats the network as an

    enhancement
  6. Not offline first •  Graceful failure to network requests •

     Just saving data client side
  7. None
  8. None
  9. THINGS TO CONSIDER

  10. ASSETS

  11. SERVICE WORKER

  12. None
  13. USER DATA

  14. None
  15. DATA: ONLINE AND OFF

  16. Data: online and off •  Traditional application data storage •

     Traditional vs offline first •  Browser based data storage •  Offline first and data
  17. TRADITIONAL APPLICATION DATA STORAGE

  18. GET / POST

  19. Traditional application data storage 1.  POST data to a server

    2.  Server stores data in a database 1.  GET request for data 2.  Server interprets request and delivers
  20. OFFLINE?

  21. TRADITIONAL VS OFFLINE FIRST

  22. INTERACT LOCALLY

  23. Interact locally •  Save data locally •  Retrieve data from

    local cache
  24. Interact locally •  Crazy fast! •  The network doesn't matter

  25. THEN SYNC

  26. Sync •  People have multiple devices •  Good as a

    backup
  27. Sync •  Can be asychronous •  Can be intentional •

     Requires network
  28. DATA STORAGE IN THE FRONT END

  29. LOCALSTORAGE

  30. LocalStorage •  Simple key value store •  Synchronous (slow)

  31. WEBSQL

  32. WEBSQL

  33. INDEXEDDB

  34. IndexedDB •  Asynchronous •  o_O

  35. MAKING DATA OFFLINE FIRST

  36. Making data offline first We need something that is: •

     Easily distributed •  Eventually consistent •  Resolves conflicts •  Web friendly
  37. None
  38. CouchDB Apache CouchDB™ is a database that uses JSON for

    documents, JavaScript for MapReduce indexes, and regular HTTP for its API
  39. None
  40. PouchDB •  CouchDB for the browser/Node •  Wraps IndexedDB or

    WebSQL •  LocalStorage adapter available as a plugin
  41. DEMO

  42. Offline first •  The time for offline first is now

    •  Distributing data like this requires a change of mindset •  Not all application data needs to be stored this way
  43. Help me! On a scale of 0 to 10, how

    likely is it that you would recommend this talk to a friend or colleague? 0203 322 5761
  44. Thanks! @philnash http:/ /philna.sh philnash@twilio.com On a scale of 0

    to 10, how likely is it that you would recommend this talk to a friend or colleague? 0203 322 5761