esp8266-fastled-webserver icon indicating copy to clipboard operation
esp8266-fastled-webserver copied to clipboard

Fixes Partial web interface #231

Open tobi01001 opened this issue 3 years ago • 4 comments

Script function to load css/js from the ESP when offline / error.

tobi01001 avatar Jan 31 '22 16:01 tobi01001

I also put my devices onto a separate (non-internet-connected) network, so I'm interested in this change. My javascript skills are not great, so while I've looked at the PR, my review is likely insufficient.

At the same time, I do wonder ...

@jasoncoon -- Can you help me understand the benefits to obtaining the files via the internet, vs. always serving them from the device?

I ask because the reasons I immediately think of don't appear to have much impact:

  1. Bugfixes / security updates: But, specific versions are requested, so it seems the CDN versions would still give the specific versions requested?
  2. License related distribution concerns: But, each of the libraries appear to be MIT-licensed, and the code is already in the device's local file system by default?
  3. Less wireless traffic to ESP: This could be... although if the ESP provides the HTTP headers to indicate these files can be cached, web clients will only request them from the device a single time.
Apparent library list & direct links to corresponding licenses

henrygab avatar Feb 27 '22 21:02 henrygab

I also put my devices onto a separate (non-internet-connected) network, so I'm interested in this change. My javascript skills are not great, so while I've looked at the PR, my review is likely insufficient.

At the same time, I do wonder ...

@jasoncoon -- Can you help me understand the benefits to obtaining the files via the internet, vs. always serving them from the device?

I ask because the reasons I immediately think of don't appear to have much impact:

  1. Bugfixes / security updates: But, specific versions are requested, so it seems the CDN versions would still give the specific versions requested?
  2. License related distribution concerns: But, each of the libraries appear to be MIT-licensed, and the code is already in the device's local file system by default?
  3. Less wireless traffic to ESP: This could be... although if the ESP provides the HTTP headers to indicate these files can be cached, web clients will only request them from the device a single time.

Apparent library list & direct links to corresponding licenses

On my side, the reason is performance (so more or less 3) . The ESP does as little as neccessary (still with room for improvement though). The browser loads the stylesheets and script ressources directly from the web... Though, when chached the impact might not be huge.

tobi01001 avatar Feb 28 '22 12:02 tobi01001

I preferred online CDN hosted resources (css, js, etc) over local ESP hosted resources initially because the ESP webserver had problems serving multiple concurrent requests. The browser would load the html and then immediately and concurrently request all of the other resources from the ESP. Sometimes the requests would hang indefinitely, others the ESP would crash. This doesn't seem to be as much of a problem with newer library versions. With client-side caching, it's not a problem after the first reload after any changes are made.

This PR seems like a great solution, I've just needed to find time to test it. If you (@tobi01001 and/or @henrygab) have already tested it, both on and offline, I trust you and we can merge it. :)

jasoncoon avatar Feb 28 '22 14:02 jasoncoon

This PR seems like a great solution, I've just needed to find time to test it. If you (@tobi01001 and/or @henrygab) have already tested it, both on and offline, I trust you and we can merge it. :)

I have limited time these for at least the 1-2 weeks. I can only say it "looks" correct. I don't know how it acts for different browsers, although @tobi01001 shows results under chrome in both online and offline cases.

henrygab avatar Mar 01 '22 10:03 henrygab