aez
aez

Reputation: 2396

How to get AppEngine data to GWT client, only once

I have a 6MB binary file in my AppEngine backed app. I need to get this file to my GWT client to do many computations. I'm trying to avoid doing the computations on the server to save my instance hours quota. But this means I have to get the file to my client somehow.

I also don't want to download it to the app each time the app is opened, that would hurt my appengine outgoing bandwidth quota.

It would be nice to download it once, then have the client somehow store it for use the next time the app is opened.

How to best do this?

A ClientBundle? Use HTML5 Storage? Is this sort of thing just not done, and should I just do the computations on the server and send the result to the client?

Upvotes: 0

Views: 117

Answers (2)

Andrei Volgin
Andrei Volgin

Reputation: 41099

You can use DataResource:

https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#DataResource

The only problem you face is the file size. Different browsers have different limits - I've seen 5MB and 8MB numbers. If you can compress your file to be under 5MB, you should be fine with most browsers. (By the way, it's an enormous amount of data if it can't be compressed any further.)

Also, you can detect a mobile browser (or offer a different URL for mobile version), and do computations on the server for mobile users.

Upvotes: 0

Kyaw Tun
Kyaw Tun

Reputation: 13141

The most easiest way to permanently cache the file is using application cache.

Another ways is HTML5 Storage (localStorage), but there is 2.5 MB limit. To use more than that amount, you have use IndexedDB (Chrome, Firefox, IE10) and WebSQL (Safari, Opera). A wrapper library like YDN-DB help in this case.

Upvotes: 1

Related Questions