Page 1 of 1

[solved] example code AdvancedWebServer.ino (newbie basics)

Posted: Mon May 20, 2019 8:42 pm
by dsyleixa
hello,
I am new to ESP and I have issues understang AdvancedWebServer.ino

in line 141: server.handleClient(); is called repeatedly in loop(),
but there is no such function listed.

Instead, there are
line 41: void handleRoot()
line 80: void handleNotFound()

how does server.handleClient() know which one - and when - to call?

Is there perhaps a detailed tutorial available on this basic topic?

Re: example code AdvancedWebServer.ino (newbie basics)

Posted: Tue May 21, 2019 8:38 am
by dsyleixa
hello,
I am new to ESP and I have issues understang AdvancedWebServer.ino

in line 141: server.handleClient(); is called repeatedly in loop(),
but there is no such function listed.

Instead, there are
line 41: void handleRoot()
line 80: void handleNotFound()

how does server.handleClient() know which one - and when - to call?

Is there perhaps a detailed tutorial available on this basic topic?

------------------------------------

edit: solved,
it's in the setup() function, surprisingly already before the begin Function

Code: Select all

  server.on("/", handleRoot);
  server.on("/test.svg", drawGraph);
  server.on("/inline", []() {
    server.send(200, "text/plain", "this works as well");
  });
  server.onNotFound(handleNotFound);