The client (AngularJS application) receives quite large lists from the server. Lists can contain hundreds or thousands of items, which can mean several uncompressed megabytes (and some users (admins) receive much more data).
I do not plan for the client to get partial results, since sorting and filtering should not bother the server.
Compression works fine (around 10), and since lists don't change often, 304 NOT MODIFIED helps too. But another important optimization is missing:
As a typical list change is pretty small (like changing two items and adding a new one), passing the changes sounds just like a good idea. I wonder how to do it right.
Something like GET /offer/123/items should always return all items in offer number 123, right? Compression and 304 can be used here, but without incremental updates. A request like GET /offer/123/items?since=1495765733 sounds like a way, but browser caching is not used:
- nothing has changed and the answer is empty (and caching it makes no sense)
- or something has changed, the client updates its state and no longer requests changes from 1495765733 (and caching makes this even less noticeable).
Obviously, when using the "from" request, nothing will be cached for the "resource" (the original request will be used only once or not at all).
Therefore, I cannot rely on the browser cache, and I can only use localStorage or sessionStorage , which have several drawbacks:
- it is limited to a few megabytes (the HTTP browser cache can be much larger and is processed automatically)
- I need to implement some replacement strategy when I get into the limit
- already compressed data is stored in the browser cache, which I donโt receive (I would have to compress it)
- it does not work for users (administrators) receiving large lists, since even one list may already be a limited limit
- it is cleared upon exiting the system (customer requirement)
Given that HTML 5 and HTTP 2.0, this is pretty unsatisfactory. What am I missing?
Can I use the HTTP browser cache along with incremental updates?
source share