Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label issue - does ESPUI do some sort of caching? #319

Open
Hacking-Away opened this issue Oct 31, 2024 · 3 comments
Open

Label issue - does ESPUI do some sort of caching? #319

Hacking-Away opened this issue Oct 31, 2024 · 3 comments

Comments

@Hacking-Away
Copy link

Hacking-Away commented Oct 31, 2024

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.... :-)

@Hacking-Away Hacking-Away changed the title Does ESPUI do some sort of caching? Label issue - does ESPUI do some sort of caching? Oct 31, 2024
@Hacking-Away
Copy link
Author

Hacking-Away commented Oct 31, 2024

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.......?

@Hacking-Away
Copy link
Author

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?

@Hacking-Away
Copy link
Author

Hacking-Away commented Nov 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant