Rails application with offline mode

8

In a new venture, I need a simple application to stay in place if the internet connection is lost. Can someone explain me how to do this?

I had thought about using the HTML5 persistence features in case of connection loss, and somehow I still do not know, synchronize between the server and client databases when the connection is retrieved. But here's the question. How to do this using Rails?

I found some examples, but they are with static files referenced in the html5 cache manifest ... I do not know if it would be the same in rails. I have not tested it yet: (

Any ideas?

    
asked by anonymous 20.09.2014 / 14:10

1 answer

6

The HTML5 Application Cache for all I know is quite complex and therefore can be a headache to implement.

My suggestions:

  • use PouchDB as suggested here (especially if you use a NoSQL database, since PouchDB can synchronize automatically).
  • Another option that may be more compatible across browsers would be to use localForage developed by Mozilla that allows you to save offline data on a common interface that uses WebSQL or IndexedDB as it is available.
  • returning to HTML5 and although not yet ready (since most browsers still do not support it), ServiceWorker will in the future be a fantastic solution to this problem (as seen in this presentation video ).

As for the server-side implementation of Rails, for all the solutions I suggested the server would just have to provide the database data in a JSON page that Javascript could access.

    
28.10.2014 / 11:22