SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
Let's take this offline
How to build mobile apps that work offline?
@ClaireReynaud

https://github.com/creynaud

www.babelbytes.com
What about you?
Subject of this talk
General how-to for making your apps work
offline
Examples:
iOS

Couchdb REST API
Django REST Framework
What do I mean by
"work offline"?
No network or slow network

Users shouldn't have to wait to
read content if they already
accessed it
No network or slow network

Users should be able to post
content all the time
Why make mobile
apps work offline?
Facebook app one year ago
We want a better
user experience!
Now users expect content when
offline
Mobile networks are different
Latency is high
Speed is very inconsistent, which is bad in terms
of UX
Watch the "Faster Websites: Crash Course on
Frontend Performance (Part 1/2)" talk from
Devoxx 2012
Your app in the wild

Try your app with the Network Conditioner
Let's implement an
Evernote-like app
Well, the text notes part ;)
In 3 steps
1. Reading notes while offline
2. Creating notes while offline
3. Updating notes while offline and solving conflicts
Put a revision in your
note objects!
Typical mobile app architecture
1. Reading notes
while offline
Reading notes while offline

Read JSON documents from a
local cache on the mobile device
Wait, HTTP has a
caching mechanism,
right?
You need a higher level cache
You may want to do offline search requests
You may want to do offline edition
You can use CoreData on top of SQLite, or
another storage mechanism.
Depending on your needs, storing the raw
JSON document in a key/value store may be
enough.
What to keep from HTTP caching
though?
For example, I don't want to re-download a given
version of a JSON document if I already have it in the
HTTP cache.
This is possible with HTTP caching headers:
Cache-Control
Etag and If-None-Match
or Last-Modified and If-Modified-Since
Let's see how it
works with Couchdb
REST API
What is Couchdb?
"A database for the web"

Couchdb is a NoSQL database
It stores JSON documents
It is schemaless
Why do I talk about Couchdb?
It is a great example for building a REST API
Spoiler alert: otherwise I don't use Couchdb
Time to play with
Couchdb
HTTP GET caching with ETAG

Blog post about NSURLCache, HTTP caching policies
and ETAG
2. Creating notes
while offline
Creating notes while offline
1. Store (e.g in SQLite) the JSON document that
needs to be posted
2. Try to post the JSON document to the server in
the background
3. Mark the JSON document has successfully
posted only if POST succeeds
4. In case of failure, retry to post the
JSON document during next sync with the server
3. Solving conflicts
on notes edition
Solving conflicts on notes edition
When you let your user update notes while offline,
conflicts will show up (even if there is no multi-user
edition).
Conflict detection
should be built in
your REST API!
Again, time to play
with Couchdb
What about Android
apps?
What about Android apps?
More or less the same:

Put a uuid and a revision on all your JSON
documents
Offline read: store your JSON Documents in
SQLite
Offline create: POST to the server in the
background and retry if needed
Offline update: handle conflicts
Try to leverage HTTP caching
What about
hybrid/web apps?
What about hybrid/web apps?
SQLite native storage: it may not be possible to
access SQLite depending on the framework you
use
HTML5 localstorage
What if I don't want
to use Couchdb?
You can use whatever you want
This is what I use, but it's really up to you
Let's see how it works with Django
REST framework
Put a uuid and a revision on your Note objects
Reject PUT or DELETE request if it does not
provide a revision (400 Bad request)
Reject PUT or DELETE request if the revision is
not the current one (409 Conflict)
Everything else comes out of the box!
https://github.com/creynaud/notes-server
https://awesomenotes.herokuapp.com/api/
Summary
Put a uuid and a revision on all your JSON
documents
Offline read: store your JSON Documents in
SQLite
Offline create: POST to the server in the
background and retry if needed
Offline update: handle conflicts
Try to leverage HTTP caching (Cache-Control,
Etag and If-None-Match headers)
Thanks! Questions?

Contenu connexe

Tendances

Getting Started With WP REST API
Getting Started With WP REST APIGetting Started With WP REST API
Getting Started With WP REST APIKishor Kumar
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationMaking Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationRuslan Strazhnyk
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS appAleks Zinevych
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumDev9Com
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...OdessaJS Conf
 
Codemotion Rome 2014
Codemotion Rome 2014Codemotion Rome 2014
Codemotion Rome 2014Ugo Lattanzi
 
Successful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsSuccessful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsJoomla Day South Africa
 
Continuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsContinuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsHugo Josefson
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarApplitools
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Shivam Bharadwaj
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockEugene Dvorkin
 
MEAN Stack Workshop at Node Philly, 4/9/14
MEAN Stack Workshop at Node Philly, 4/9/14MEAN Stack Workshop at Node Philly, 4/9/14
MEAN Stack Workshop at Node Philly, 4/9/14Valeri Karpov
 
Reusability is the goal
Reusability is the goalReusability is the goal
Reusability is the goalRed Pill Now
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integrationPeter Gfader
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Hong Tat Yew
 
Tooling for the productive front end developer
Tooling for the productive front end developerTooling for the productive front end developer
Tooling for the productive front end developerMaurice De Beijer [MVP]
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorKasun Kodagoda
 
Google App Engine - Java Style
Google App Engine - Java StyleGoogle App Engine - Java Style
Google App Engine - Java StylePeter Lind
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with ReactjsThinh VoXuan
 

Tendances (20)

Getting Started With WP REST API
Getting Started With WP REST APIGetting Started With WP REST API
Getting Started With WP REST API
 
Build a chatroom!
Build a chatroom!Build a chatroom!
Build a chatroom!
 
Making Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI AutomationMaking Watir and Cucumber an efficient tool for Web UI Automation
Making Watir and Cucumber an efficient tool for Web UI Automation
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and Selenium
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
 
Codemotion Rome 2014
Codemotion Rome 2014Codemotion Rome 2014
Codemotion Rome 2014
 
Successful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine RankingsSuccessful Joomla migrations that don't hurt Search Engine Rankings
Successful Joomla migrations that don't hurt Search Engine Rankings
 
Continuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsContinuous Integration with Maven for Android apps
Continuous Integration with Maven for Android apps
 
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil TayarCypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
Cypress vs Selenium WebDriver: Better, Or Just Different? -- by Gil Tayar
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock
 
MEAN Stack Workshop at Node Philly, 4/9/14
MEAN Stack Workshop at Node Philly, 4/9/14MEAN Stack Workshop at Node Philly, 4/9/14
MEAN Stack Workshop at Node Philly, 4/9/14
 
Reusability is the goal
Reusability is the goalReusability is the goal
Reusability is the goal
 
SQL Server - CLR integration
SQL Server - CLR integrationSQL Server - CLR integration
SQL Server - CLR integration
 
Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)Introduction to cypress in Angular (Chinese)
Introduction to cypress in Angular (Chinese)
 
Tooling for the productive front end developer
Tooling for the productive front end developerTooling for the productive front end developer
Tooling for the productive front end developer
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using Protractor
 
Google App Engine - Java Style
Google App Engine - Java StyleGoogle App Engine - Java Style
Google App Engine - Java Style
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with Reactjs
 

En vedette (13)

Bigbike
BigbikeBigbike
Bigbike
 
Animals!
Animals!Animals!
Animals!
 
Papan ide proposal bisnis
Papan ide proposal bisnisPapan ide proposal bisnis
Papan ide proposal bisnis
 
The bigbike
The bigbikeThe bigbike
The bigbike
 
อุปกรณ์เชื่อมต่อคอมพิวเตอร์
อุปกรณ์เชื่อมต่อคอมพิวเตอร์อุปกรณ์เชื่อมต่อคอมพิวเตอร์
อุปกรณ์เชื่อมต่อคอมพิวเตอร์
 
GPO Trends and Perspectives: Premier’s Economic Outlook
GPO Trends and Perspectives: Premier’s Economic OutlookGPO Trends and Perspectives: Premier’s Economic Outlook
GPO Trends and Perspectives: Premier’s Economic Outlook
 
Bigbike
BigbikeBigbike
Bigbike
 
กีฬา.
กีฬา.กีฬา.
กีฬา.
 
บัตรสมาชิก Touch Card ศูนย์การค้าฟอร์จูนทาวน์
บัตรสมาชิก Touch Card ศูนย์การค้าฟอร์จูนทาวน์บัตรสมาชิก Touch Card ศูนย์การค้าฟอร์จูนทาวน์
บัตรสมาชิก Touch Card ศูนย์การค้าฟอร์จูนทาวน์
 
อุปกรณ์พื้นฐานคอมพิวเตอร์
อุปกรณ์พื้นฐานคอมพิวเตอร์อุปกรณ์พื้นฐานคอมพิวเตอร์
อุปกรณ์พื้นฐานคอมพิวเตอร์
 
Bigbike
BigbikeBigbike
Bigbike
 
Gatling - SoftShake 2013
Gatling - SoftShake 2013Gatling - SoftShake 2013
Gatling - SoftShake 2013
 
Ppt on article by manish kumar
Ppt on article by manish kumarPpt on article by manish kumar
Ppt on article by manish kumar
 

Similaire à Softshake 2013 - Let's take this offline

Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitWittawas Wisarnkanchana
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentationTom Johnson
 
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.jsGetting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.jsGrant Goodale
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkLushen Wu
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageBinary Studio
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHPGautam Rege
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTManish Pandit
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails FinalRobert Postill
 
Modern JavaScript Talk
Modern JavaScript TalkModern JavaScript Talk
Modern JavaScript TalkDerek Binkley
 
HTTP Plugin for MySQL!
HTTP Plugin for MySQL!HTTP Plugin for MySQL!
HTTP Plugin for MySQL!Ulf Wendel
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
 
Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...boxuno
 

Similaire à Softshake 2013 - Let's take this offline (20)

Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentation
 
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.jsGetting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
 
ODF Mashups
ODF MashupsODF Mashups
ODF Mashups
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic Beanstalk
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Academy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storageAcademy PRO: HTML5 Data storage
Academy PRO: HTML5 Data storage
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
Web Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptxWeb Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptx
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you REST
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails Final
 
Proposal
ProposalProposal
Proposal
 
Modern JavaScript Talk
Modern JavaScript TalkModern JavaScript Talk
Modern JavaScript Talk
 
HTTP Plugin for MySQL!
HTTP Plugin for MySQL!HTTP Plugin for MySQL!
HTTP Plugin for MySQL!
 
Dean4j@Njug5
Dean4j@Njug5Dean4j@Njug5
Dean4j@Njug5
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...
 
Universal apps lightning talk
Universal apps lightning talk Universal apps lightning talk
Universal apps lightning talk
 

Dernier

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Softshake 2013 - Let's take this offline

  • 1. Let's take this offline How to build mobile apps that work offline?
  • 4. Subject of this talk General how-to for making your apps work offline Examples: iOS Couchdb REST API Django REST Framework
  • 5. What do I mean by "work offline"?
  • 6. No network or slow network Users shouldn't have to wait to read content if they already accessed it
  • 7. No network or slow network Users should be able to post content all the time
  • 8. Why make mobile apps work offline?
  • 9. Facebook app one year ago
  • 10. We want a better user experience!
  • 11. Now users expect content when offline
  • 12. Mobile networks are different Latency is high Speed is very inconsistent, which is bad in terms of UX Watch the "Faster Websites: Crash Course on Frontend Performance (Part 1/2)" talk from Devoxx 2012
  • 13. Your app in the wild Try your app with the Network Conditioner
  • 14. Let's implement an Evernote-like app Well, the text notes part ;)
  • 15. In 3 steps 1. Reading notes while offline 2. Creating notes while offline 3. Updating notes while offline and solving conflicts
  • 16. Put a revision in your note objects!
  • 17. Typical mobile app architecture
  • 19. Reading notes while offline Read JSON documents from a local cache on the mobile device
  • 20. Wait, HTTP has a caching mechanism, right?
  • 21. You need a higher level cache You may want to do offline search requests You may want to do offline edition You can use CoreData on top of SQLite, or another storage mechanism. Depending on your needs, storing the raw JSON document in a key/value store may be enough.
  • 22. What to keep from HTTP caching though? For example, I don't want to re-download a given version of a JSON document if I already have it in the HTTP cache. This is possible with HTTP caching headers: Cache-Control Etag and If-None-Match or Last-Modified and If-Modified-Since
  • 23. Let's see how it works with Couchdb REST API
  • 24. What is Couchdb? "A database for the web" Couchdb is a NoSQL database It stores JSON documents It is schemaless
  • 25. Why do I talk about Couchdb? It is a great example for building a REST API Spoiler alert: otherwise I don't use Couchdb
  • 26. Time to play with Couchdb
  • 27. HTTP GET caching with ETAG Blog post about NSURLCache, HTTP caching policies and ETAG
  • 29. Creating notes while offline 1. Store (e.g in SQLite) the JSON document that needs to be posted 2. Try to post the JSON document to the server in the background 3. Mark the JSON document has successfully posted only if POST succeeds 4. In case of failure, retry to post the JSON document during next sync with the server
  • 30. 3. Solving conflicts on notes edition
  • 31. Solving conflicts on notes edition When you let your user update notes while offline, conflicts will show up (even if there is no multi-user edition).
  • 32. Conflict detection should be built in your REST API!
  • 33. Again, time to play with Couchdb
  • 35. What about Android apps? More or less the same: Put a uuid and a revision on all your JSON documents Offline read: store your JSON Documents in SQLite Offline create: POST to the server in the background and retry if needed Offline update: handle conflicts Try to leverage HTTP caching
  • 37. What about hybrid/web apps? SQLite native storage: it may not be possible to access SQLite depending on the framework you use HTML5 localstorage
  • 38. What if I don't want to use Couchdb?
  • 39. You can use whatever you want This is what I use, but it's really up to you
  • 40. Let's see how it works with Django REST framework Put a uuid and a revision on your Note objects Reject PUT or DELETE request if it does not provide a revision (400 Bad request) Reject PUT or DELETE request if the revision is not the current one (409 Conflict) Everything else comes out of the box! https://github.com/creynaud/notes-server https://awesomenotes.herokuapp.com/api/
  • 41. Summary Put a uuid and a revision on all your JSON documents Offline read: store your JSON Documents in SQLite Offline create: POST to the server in the background and retry if needed Offline update: handle conflicts Try to leverage HTTP caching (Cache-Control, Etag and If-None-Match headers)