Label issue - does ESPUI do some sort of caching?
Opened this issue · 3 comments
I am using a label to display an image:
image1Label = ESPUI.label("An Image Label", ControlColor::Peterriver, "<img src='path/to/image'>");
The img src is another webserver instance on the ESP, on port 81, serving only the image. This works fine, i see the image in the label.
I can update the label later just fine, with:
ESPUI.updateLabel(image1Label,"test update");
But if i change the image served by the above second server instance and try to update the label with:
ESPUI.updateLabel(image1Label, "<img src='path/to/image'>");
I still get the old image unless i use the browser to refresh the page.
If I go direct to the URL in the browser i can see it has indeed updated, so it's only ESPGUI that isn't getting the new image.
Is it some sort of caching?
Any ideas appreciated.... :-)
I think I have basically confirmed the CLIENT end of ESPUI is caching.... when i reboot the ESP32 and leave the browser page open, once it reboots and i click on a tab and back to the original tab a lot of things have updated, but only a hard browser refresh updats the image that is in the label.
How can I stop this.......?
I'm really trying to help myself here, but more knowledgable help would be much appreciated :-)
My test web app works fine, the only issue is when in my code i change the image which is displayed in a label, i need to refresh the browser.
I have sound in the ESPUI library files some things like:
#define UI_RELOAD MessageTypes::Reload
and
if(ClientUpdateType_t::ReloadNeeded == value) { // Serial.println(F("ESPUIclient::SendClientNotification:set type to reload")); document["type"] = int(UI_RELOAD);
Which looks like it does a client side reload of the UI which is what i want, but how can i make this happen from my Arduino code?
Well, i found this #68
And putting ESPUI.jsonReload();
which works for me! :-) After i get a new image i call label.update then ESPUI.jsonReload.