Go Down

Topic: Missing responses using XMLHttpRequest(); Issue solved. See below. (Read 979 times) previous topic - next topic


I am using the Uno WIFI Rev2 as a temperature controller with web interface. The web page requests data using an XMLHttpRequest(); every second. Things run but I do see quite often a very long response time from the Audino about 2 seconds. This is worse if it is configured as an access point as opposed to a server. Since I'm running a processing loop to keep track of times and control the temperature there is a fair bit of processing going on within the loop. It takes about 40 msec of processing time per loop.

The response on the ethernet gets considerably worse if I put a load on the processor.  The code I have is a temperature controller.  I see the controller code works correctly but I can get up to 17 sec delays on the ethernet side as measured with Chrome.

I have stripped out my web page and Audino processing into a seperate file to be sure I did not have a problem with my processing code. That file is attached. I have also attached a screenshot of the web page running on Chrome with the developers tools open to a long delay.

Is the processing I'm seeing as good as I can expect from the Uno WIFI Rev2?? IE am I going to see these delays or is there a bug in the wifinina library? I do have two Uno WIFI Rev2 boards both with up to date firmware as of 7/2/2020. One of the boards is much worse than the other. I do note that the temperature control loop continues to work as the web interface struggles.

I had this posted on GitHub but closed it as I got no response.

Would some else download the attached code and try it on their Wifi Rev 2 and monitor the response times?  The code will set up the arduino board as a server called beer.  The password is 12345678.  Connect to the Arduino and open a web page at  This should start a counter running every 1 sec as the web page requests a byte of data from the board every second.



Good catch.  I corrected my get response code and added correct HTML headers.  The problem is now much less even with the processor under load.

I have attached the corrected code and the HTML code incase it is helpful to someone else as an example.


add Content-length header
and is it not JSON for content-type?


OK.  I added a content-length header to the web page response and content-length and changed the content-type to application/json as the get response is json encoded.

Now when I run the webpage the Chrome waterfall shows times up to 366 ms.  Acceptable and improved.





The corrected Arduino code is attached.


some reading

Go Up