-->
Page 1 of 1

Understanding handleRoot() ESp8266 Serbver

PostPosted: Mon Aug 08, 2022 2:02 pm
by rascalsailor
Hi - I am using a D1 - esp8266 to do a simple led on/off and am experimenting with sending text and html to a webpage.
In the handleRoot() function:
I have:

Code: Select allvoid handleRoot() {
  server.send(200, "text/plain", "hello from esp8266! (blinking LED!)"); // first line
  server.send(200, "text/plain", "Further text..."); //second line
}

But I only see the first line in the browser when handleRoot gets called.
If I comment out the first line then the second line gets sent.
What am I not understanding?
thanks
Russell

Re: Understanding handleRoot() ESp8266 Serbver

PostPosted: Mon Aug 08, 2022 11:44 pm
by JurajA
for one request you can send only one response

Re: Understanding handleRoot() ESp8266 Serbver

PostPosted: Tue Aug 09, 2022 1:42 am
by rascalsailor
Thanks for reply -


regards
Russell

Re: Understanding handleRoot() ESp8266 Serbver

PostPosted: Wed May 10, 2023 11:01 pm
by superedan
This article is very nice and helpful. I find the information printed in the article will help readers.