Offline Web application server and client application takes position

Asked

Viewed 107 times

1

I wonder if there’s a way for a client application to take over when the server is down, like a Dropbox, for example, you can put a file, or a directory inside the folders that are synced through the program (Dropbox) and it will only sync when the computer is connected to the Internet or when the Dropbox server airs again. But speaking now in Web application, can you do this? The Internet crashed or the server was out, in the next request where the connection did not signal the return of the server will redirect to a web page or some resource in the browser within the computer itself where the user can make certain operation, as soon as the connection is reestablished the client data will be synchronized with the server without losing any information and the user realizes that the connection with the website has crashed.

  • 1

    Analyze the type of application before doing. This is not trivial and this kind of thing is usually done when there is no competition from 'users' in changing data. You would also have to implement some kind of control over what data has been changed by users who have not lost the connection and this is not so trivial in most cases. Finally, redundancy links or server cluster strategies are usually safer and with faster and less complex implementation cost.

  • Thanks for your reply @Intruso, I will take into account when choosing the best architecture.

1 answer

2


There is way yes, from html 5 there is a specification own for offline app, besides there are several Apis that facilitate the cache of Resources to take over when the server for some reason is offline. Despite everything, this work is not trivial, nothing is done "automatically". I’ll leave you some links so you can check.

Specification of offline pages: http://www.w3.org/TR/2011/WD-html5-20110525/offline.html Very good article on the subject: http://diveintohtml5.com.br/offline.html

So far solved the problem of offline pages, in addition, you will need to save the data with the user changes to later transmit to the server, in the specification html 5 there are 2 alternatives, Web Sql Database and Web Storage.

In the case of Web Sql Db, it is basically a Sqlite database, ie with minimal persistence functions, that the browser itself offer, you can see an example of how to use it here: http://elemarjr.net/2010/10/19/html-5-parte-6-armazendando-dados-com-web-sql-databases/

As for the web Storage, it is something like a key map and local value also offered by the browser, it is almost a cookie but it is not sent to the server, you can see more information on how to use it here: http://elemarjr.net/2010/10/18/html-5-parte-5-armazenando-dados-com-web-storage/

  • Thank you, that way then would be limited then? My idea is that I should save the data in a temporary database and synchronize with the server afterwards.

  • Very good the second article. Even gave an idea to resolve a situation on my site, which is to present a page in the offline style.

  • 1

    The browsers currently comes with a local sqlite "database", you can save the data to it and sync later.

  • 1

    Could you put an answer to this @Ricardorodriguesdefaria? Thank you in advance. I found something about what you said: http://stackoverflow.com/questions/6200976/sqlite-in-chrome.

  • Thanks for editing in your reply @Ricardorodriguesdefaria, now it remains to know how to synchronize with the remote server, but I believe it is a question for another question.

  • 1

    The synchronization part is something that has to be implemented manually, once you realize the server is online again, you check if there have been user changes and send them in the background to the server. Unfortunately there is no specification for this part.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.