Bijan Vaez -Developing Offline Capable Mobile Web Apps

11
Developing Offline Capable Mobile Web Apps

description

Bijan delivers lessons from eventmobi in delivering offline capable mobile web applications.

Transcript of Bijan Vaez -Developing Offline Capable Mobile Web Apps

Page 1: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Developing Offline Capable Mobile Web Apps

Page 2: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Motivation

Instant UpdatesFull customizabilityReal-time feedback

Page 3: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Goals

• Remedy poor connectivity–Make web not connected to ‘the web’

• Increase performance–Make web as close as possible to native

Page 4: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Technologies

• HTML5– App Cache / Manifest– Local Storage–WebSQL (deprecated)– IndexDB (still not fully spec’ed)

• New clientside Javascript possibilities

Page 5: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Demo Time

Page 6: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Build it!

• LocalStorage + Manifest + Robust API• Cache Manifest stores as few items as possible• The single page app• Images needed for the app (UI)

Page 7: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Tools Used

• Backbone.js (MVC-like JS architecture)

• Zepto (JS Framework)

• Handlebars.js (Templating)

• CoffeeScript (Increase speed of dev, reduce rage)

• Sprockets (Asset Management)

• SASS/SCSS & HAML

Page 8: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Techniques

• Architecture: Single Page App– Reduce round-trips to server as much as possible

• Inline, compressed JS, CSS

– Get to API data collection ASAP• Parse, execute – models, views, templates, at run-time• ‘Stringify’ code and eval later when needed

Page 9: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Improvements• Clients are

the SLOW part of the web

– Lazy Load everything (got us 90%+ performance improvement)

Page 10: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Issues

• Needs A LOT of data on first hit– Could choke at bigger conferences (60K people loading

at once)

• Does not work on IE yet (Zepto to blame but other techniques not well supported on WP7 or IE)

Page 11: Bijan Vaez -Developing Offline Capable Mobile Web Apps

Still in Progress• Node.js + Socket.IO + Redis stack– For real-time updates, interactive features

• Offline usage– Store actions in offline state in queue– Sync with server when online

• Ensure consistency with data across multiple devices (Vector / Lamport clocks?)