So you can load css and such with javascript:
https://www.geeksforgeeks.org/how-to-load-css-files-using-javascript/
https://stackoverflow.com/questions/574944/how-to-load-up-css-files-using-javascript

https://stackoverflow.com/questions/4724606/how-to-use-javascript-to-check-and-load-css-if-not-loaded/25615777

What I am doing is loading JSON like this.

function loadjson() {
xmlhttp = new XMLHttpRequest();
xmlhttp.timeout = 500; // time in milliseconds
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
//handle parsing json and updating fields
 }
xmlhttp.open("GET", "/json", true);
xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
xmlhttp.ontimeout = function () {
//exit and do nothing we will make another request
// here if you are not doing a periodic load you could call function again
to try again.
}
xmlhttp.send();
}

  setInterval(loadjson , 1000);


On Sun, May 10, 2020 at 2:51 PM Mário Luzeiro <mrluze...@ua.pt> wrote:

> Hi Trampas, thanks for sharing.
> It was not clear, are you using some custom loading of resources (eg
> script and css files) ? Or do you mean just data (such as JSON)?
> Could you share details how that is performed?
> I was looking for some way that I can manage the loading manually and
> request each resource one by one instead of browser doing it..
> but I couldn't find a way.
>
> Unfortunately from what I search, there is no way to configure the
> browsers how should they behave on loading the multiple resources files.
> I tried some tags for preload etc and none made any effect (at leas in
> firefox, where I was testing..)
>
> Mario
>
> ________________________________________
> From: lwip-users <lwip-users-bounces+mrluzeiro=ua...@nongnu.org> on
> behalf of Trampas Stern <tram...@gmail.com>
> Sent: 10 May 2020 13:21
> To: Mailing list for lwIP users
> Subject: Re: [lwip-users] httpd, tls, multiple get requests, delays
>
> I have ran into similar issues.  I ended up changing my HTML source files.
>
> To understand let me start with the background.  I have a web page where
> ever second I request data from the embedded server and display it.  So in
> the Javascript for the web page I had a 1000ms timeout that requested new
> data(file).  This worked great on the bench.  However the customer was
> testing it and complaining about it being slow.  As it turns out the issue
> was the customer had a slow laptop and when they started a zoom meeting the
> network traffic on the laptop went up and my device got really really slow.
> What I found was happening is I would make a request for data, it would
> time out inside chrome which would retry the request.  That is as the
> requests timed out in the browser it would retry, this meant as time moved
> forward I would start with browser trying to request one copy of data, then
> if that timed out it would request it again while my timer in javascript
> also requested it again, now I had two connections for the same file on the
> embedded device. Then three, then four...
>
> The solution was to change the javascript such that it made request and if
> I did not get a response in 500ms it would time out the request, before I
> made a second request. This way at any time the browser would only allow
> one request per file. I also could increase the timeout between requests to
> match network speed.   I found this also needed to be done with CSS files.
> That is sometimes I found that I would get random failure requesting
> files.  For example at one time my Phy chip was getting too hot and causing
> random network failures that cause havoc on my system.  I found that this
> would cause random failures, and retries.  By having the javascript control
> the time out on the file it helped.  That is with the random failures and
> the time out for the http connection in lwip I would again get where I had
> two open connections for the same resource/file.  Hence timing out on
> javascript would send the close to the server and thus kill one connection
> before starting a new one.
>
> This also leads to the other issue, when you use LWIP you have think about
> how the system handles multiple requests for the same resource.  That is if
> you are sending out a file can lwip have two open connections to the file?
> For example two computers accessing your server at the same time.  This is
> one reason I implemented authentication system, as it restricts the number
> of connections, by restricting the number of users.
>
> Trampas
>
>
>
> On Sat, May 9, 2020 at 5:03 PM Mário Luzeiro <mrluze...@ua.pt<mailto:
> mrluze...@ua.pt>> wrote:
> Hello all,
>
> I'm looking for some ideas how can I improve an issue I have.
> I have a httpd over TLS. As you may know, browsers fire multiple requests
> at same time to get the resources.
>
> I had a lot of issues related with TLS / LWIP connections to handle this
> multiple connections but the major are now working ok...
> but as you can see in the screenshot, despite most of the requests are
> handled very quickly but for some reason.. some will take too long to
> handle.
> There is some pattern on this, sometimes a bit random on the time it
> takes..
> The first time the browser connects to the server it takes a lot to
> initialize the TLS, but its ok because the next ones are very fast.. except
> that random get requests
>
> Any idea how can it be improved ?
>
> I already support 20 TCP connections ( MEMP_NUM_TCP_PCB is 20 * 2 ) and
> played with lots of parameters that I tuned for the best results except
> this last one..
>
> Regards,
> Mario Luzeiro
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org<mailto:lwip-users@nongnu.org>
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to