Re: example code AdvancedWebServer.ino (newbie basics)

dsyleixa
Posts: 12
Joined: Mon May 20, 2019 8:33 pm

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

Postby dsyleixa » Mon May 20, 2019 8:42 pm

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?
Last edited by dsyleixa on Tue May 21, 2019 8:41 am, edited 1 time in total.

dsyleixa
Posts: 12
Joined: Mon May 20, 2019 8:33 pm

Re: example code AdvancedWebServer.ino (newbie basics)

Postby dsyleixa » Tue May 21, 2019 8:38 am

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);
Last edited by dsyleixa on Tue May 21, 2019 8:51 am, edited 1 time in total.

Who is online

Users browsing this forum: No registered users and 7 guests