ESPAsyncWebServer on ESP32

A project log for Low cost / low power sleep / WiFi Camera

Using e.g. ESP32 and cheap camera to make a remote monitoring device that can watch things e.g. meters, gages, etc...

james-newtonJames Newton 01/16/2019 at 19:065 Comments

While the standard ESPAsyncWebServer does work on the ESP32, the author does not support the Arduino IDE for it's use, preferring PlatformIO. I want to stay with the ugly beast because it makes the code accessible to a wider range of people (Ok, really I just don't want to learn Yet. Another. IDE). Specifically, the the examples for web servers do not work in the Arduino IDE. However, this page provides a series of examples (See "Related Posts") which document how to make it work.

e.g. a simple web server via access point:

#include "WiFi.h"
#include "ESPAsyncWebServer.h"
const char *ssid = "MyESP32AP";
const char *password = "testpassword";
AsyncWebServer server(80);
void setup(){
  WiFi.softAP(ssid, password);
  Serial.print("IP address: ");
  server.on("/hello", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send(200, "text/plain", "Hello World");
void loop(){}

 I'm assuming the Async Web Server is still a better option than the built in web server which requires polling (VERY unstable if you do anything of note in the main loop). Please let me know if you have a better option. 


Priyank C wrote 04/25/2019 at 18:01 point

I did not try yet but it is very much possible to use  ESPAsyncWebServer in Arduino.

This project used the lib and is built in Arduino IDE.

  Are you sure? yes | no

James Newton wrote 01/17/2019 at 20:09 point

So what about the people out there who just have the Arduino IDE and ESP board support files? Can I easily move the code I write in Platform IO back into the Arduino IDE for them? I don't want to put a barrier in front of people who want to just load the code and maybe tweak a few settings. This is my major concern because the incompatibility is already obvious with the example code from the Async Web server library.

  Are you sure? yes | no

Martin Fasani wrote 01/17/2019 at 08:13 point

I agree with you. But I highly recommend to try PlatformIO. First of all, it's a real IDE, and you can navigate with Ctrl+click through classes. And then I find it much better to keep your dependencies, since they have a piolibdeps per project (No more libraries in 3 different folders like Arduino that drives me crazy).
And it's not so difficult to get to use it, took me about 1/ 2 hours to get started and compile something.

Will try this when I have some time at home. For sure there is a way to make it work in Arduino if you can get the dependencies right.

  Are you sure? yes | no

Jarrett wrote 01/17/2019 at 08:56 point

I second that. It's actually more of a plugin to Atom or VSCode, which are capable IDEs in their own rite, and are good for all sorts of things. I use VSCode with PlatformIO.

And, because PlatformIO can use Arduino libraries and seamlessly integrates with everything Arduino does, it's better than the actual Arduino IDE. Also a kind of intermediate step to using not-Arduino (and with it, better memory / sleep / power management and all sorts of power options, if you want them).

It really is what I recommend everyone use for Arduino development.

  Are you sure? yes | no

Xasin wrote 01/17/2019 at 10:16 point

Is it fairly easy to publish libraries for PlatformIO? It definitely sounds useful, and maybe I could use that to make my Lasertag project easier to hack, but only if homebrew libraries are easy to add ^^

I'm working with the raw ESP IDF and Eclipse right now, which, although surprisingly comfortable and well documented, I can imagine might be a bit of a hassle for others to install ^^'

  Are you sure? yes | no