Hello there! (General Kenobi...)
I've got a project where one ESP8266 acts as a web server (and access point) while another acts as an HTTP client (and station). The client does a GET of the information on a particular page on the server, and it works fine, but...
It's kind of slow. This is going to sound silly, but it takes about 5 seconds for the station/client to connect to the AP/server and perform the GET. It actually slows down something that I was hoping to have go much faster, and it makes me wonder if there is anything I could do with my GET request to make it pull the data faster.
Here's the code from the AP/server:
void handleSettings() {
String strSpeed = String(speed);
String strSound = String(sound);
String strDuration = String(duration);
String strSettings = strSpeed + "," + strSound + "," + strDuration;
webserver.send(200, "text/plain", strSettings);
}
And here's the code from the station/client:
if (client.connect(ap, 80)) {
Serial.println("Connected to Transmitter");
String url = "/settings";
client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + ap + "\r\n" + "Connection: close\r\n\r\n");
delay(10);
while(client.available()){
line = client.readStringUntil('\r');
}
Obviously, I'm GETting three settings that are posted on the /settings page (speed, sound, and duration). Right now, I'm just putting those three settings on the settings page (they look like three numbers separated by commas - like 3,2,2) and then using Substring to split them up for the client to use. Is there a better/faster way to do this?
Thanks!
Matt