Project

General

Profile

caching client image data

Added by Michael Buro over 10 years ago

I am interested in using (j)wt for porting an existing card game server.

Users download the current html5/javascript based version

which includes 2MB of card image data. In the GUI javascript copies card

images stored in local files into an html5 canvas.

Is there a way for wt clients to reuse data from previous sessions

without the need for downloading it every time? How could above fast local

image copy be implemented in wt (without resorting to special purpose

javascript if possible) - perhaps using html file caching?


Replies (1)

RE: caching client image data - Added by Wim Dumon over 10 years ago

Hello Michael,

If you serve the images with the proper HTTP caching attributes, the browser's cache should keep the images for you. Wt's built-in httpd is not very configurable in this respect, so you may consider using e.g. nginx or apache to serve the static files.

If you don't even want the users to have to wait when the images are shown for the first time, you can create a WImage for all the cards and call hide() on them, e.g. on the login screen. The images will then be downloaded in the background and the browser will not show them.

BR,

Wim.

    (1-1/1)