Friday, August 29, 2014

Re: GWT App in Offline mode

Thanks for you answer Peter. I'm mostly concerned about the third issue. I mean, what if the total size of images that I need to cache exceeds 5MB that are available in Local Storage?


On Thursday, 28 August 2014 10:39:02 UTC+2, Peter Donald wrote:
Hi,

We store the required subset of the application in local storage [2]
(or in WebSQL or in IndexedDB [1] depending on browsers). We also make
heavy use of the AppCache [3,4] spec to cache the application code and
resources.

We also treat user supplied data such as images much like the rest of
the server supplied data and store it in local storage and friends.
There is a few more difficulties to load data out of appcache as
images but a google search turns up a few overviews [5].

We wrote gwt-appcache to help with your point 2 and it is available in
maven central and documented at
https://github.com/realityforge/gwt-appcache.

Hope that helps.


[1] http://en.wikipedia.org/wiki/Indexed_Database_API
[2] http://en.wikipedia.org/wiki/Web_Storage
[3] http://www.html5rocks.com/en/tutorials/appcache/beginner/
[4] http://appcachefacts.info/
[5] https://hacks.mozilla.org/2012/02/saving-images-and-files-in-localstorage/

On Thu, Aug 28, 2014 at 4:16 AM, Nikola Ljumovic
<nikola....@gmail.com> wrote:
> Hi all,
>
> I have to enable my app to work in offline mode and to continue working even
> if the browser is reloaded. I'm currently struggling with caching. I thought
> of doing the following:
>
> Get all the needed data from the server when the application loads (list of
> app users, user roles, customers, configuration data, etc.) and cache it on
> the client using LocalStorage. Is this the right way to do it?
> Get all static resources (mostly images, button icons, etc) by using
> ClientBundle. This, if i'm not mistaken will also perform caching but I'm
> not sure if these resources will remain cached even if the client is offline
> and the browser is refreshed?
> In my app users define their own button layout and can upload their own
> images and use them in the layout. Therefore, when application loads I need
> to get these images from the server and cache them on the client to enable
> the layout to show correctly. Do you have any sugesstions on how should I do
> this, since these images are not predefined in compile time but instead they
> are defined by user in the runtime, and therefore I can't use ClientBundle.
>
> I would really appreciate your help on this, especially on the last issue .
> Thanks in advance!
>
> Nikola
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit+unsubscribe@googlegroups.com.
> To post to this group, send email to google-we...@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Peter Donald

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment