The last part of WiFiWebServer Example is:
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
s += (val)?"high":"low";
s += "</html>\n";
// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
adding:
client.flush();
client.stop();
here:
// Send the response to the client
client.print(s);
delay(1);
client.flush();
client.stop();
Serial.println("Client disonnected");
causes the client to be disconnected and the web page is updated streight away.
This is not going to change the world but it may help someone.
Enjoy.