Commands from web page to YunClient become slow

Commands from web page to YunClient become slow

I have a web page on my PC connected to Yun with Ethernet patch where I repeat every 5000 ms the same message using a function with following code:

server = "arduino/cmd/1";
request = new XMLHttpRequest();
request.open("GET", server, true);
request.send(null);

In the sketch uploaded in 32U4 I'm using the following functions :

YunClient client = server.accept();
// new messagge?
// call process() function for message management
if (client ) {
process(client);
// at the end close the client
client.stop();
delay(5);
}

The problem is that at the start of program the response time in very fast, after 800 requests I have to wait about 2,5 seconds , after 1600 requests I have to wait about 5 seconds before 32U4 do some action.
If I stop the messages from web page for a lot of time the delay time remains 5 seconds. Only if I disconnect the ethernet patch for a lot of time the delay becomes like after the boot of Arduino.
There is a command with wich can I try to reduce to 0 the delay time from Web message sending and 32U4 acknowledgement of message?

I tryed to put a "Bridge.begin();" in arduino sketch every command received but I haven't solved the problem: nothing is changed.

Many thanks for help

best regards

Rossano

Solved!
I tried to disable REST API password and now the delay from sending command and acknowledge don't increase!

Bye

Rossano