Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 17 17:39
    AaronD-GH commented #1151
  • May 17 14:12
    VNovytskyi commented #1160
  • May 17 13:14
    zekageri commented #1160
  • May 17 13:12
    zekageri commented #1160
  • May 17 12:51
    VNovytskyi commented #1160
  • May 17 11:28
    maxgerhardt commented #970
  • May 17 11:28
    maxgerhardt commented #970
  • May 17 10:03
    zekageri commented #1160
  • May 17 10:00
    zekageri commented #1160
  • May 17 00:42
    DanteNahuel commented #1147
  • May 16 20:59
    RadianM commented #1131
  • May 16 17:20
    arslan437 commented #1151
  • May 16 17:18
    arslan437 commented #1151
  • May 16 14:04
    VNovytskyi edited #1160
  • May 16 14:03
    VNovytskyi opened #1160
  • May 16 13:50
    RadianM commented #1131
  • May 16 12:34
    VNovytskyi closed #1143
  • May 16 12:34
    VNovytskyi commented #1143
  • May 16 11:48
    vatsake commented #1156
  • May 16 09:55
    vatsake closed #1156
Tomas Hübner
@Titantompa
Hey everyone, I'm woking on a clock using pinball score reels based on an ESP32, and I'm storing some data in an I2C eeprom that happened to be on the same module as the DS1307 used to keep time when power is off.
I've added a page with a simple form to change the config. I did have major issues writing data to the eeprom in a callback from the ESPAsyncWebServer - as it turned out there were some yield()s in the lib I use for eeprom access. At least I think that was what caused the problems.
However, being well aware that assumption is the mother of all fuckups, I just wanted to check if anyone knows if there is anything in ESPAsyncWebServer that actually would interfere with the TwoWire implementation?
2 replies
bigtiger0905
@bigtiger0905

hi everyone, i have random wdt.
E (285848) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (285848) task_wdt: - IDLE0 (CPU 0)
E (285848) task_wdt: Tasks currently running:
E (285848) task_wdt: CPU 0: Task0
E (285848) task_wdt: CPU 1: IDLE1
E (285848) task_wdt: Aborting.
abort() was called at PC 0x40174258 on core 0

ELF file SHA256: 0000000000000000

Backtrace: 0x400887e8:0x3ffbfa70 0x40088a65:0x3ffbfa90 0x40174258:0x3ffbfab0 0x40086f25:0x3ffbfad0 0x4000bfed:0x3ffdb970 0x4008abe9:0x3ffdb980 0x400894e1:0x3ffdb9a0 0x40166866:0x3ffdb9e0 0x4015633c:0x3ffdba00 0x400d8981:0x3ffdba20 0x400d89e6:0x3ffdba50 0x400d8a55:0x3ffdba70 0x400d8e96:0x3ffdba90 0x4018afb6:0x3ffdbac0 0x400ea915:0x3ffdbaf0 0x400ea9ad:0x3ffdbb10 0x400de266:0x3ffdbb30 0x400dc9e9:0x3ffdbcf0 0x400d82e2:0x3ffdbd40 0x400d3b00:0x3ffdbd60 0x40089a76:0x3ffdbd80

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,l
2021-10-26 12:15:37.713
en:10124
load:0x40080400,len:5828
entry 0x400806a8

Decoding stack results
0x400887e8: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 156
0x40088a65: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 171
0x40174258: task_wdt_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/task_wdt.c line 174
0x4008abe9: vTaskExitCritical at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c line 4274
0x400894e1: xQueueGenericSend at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 828
0x40166866: sys_mutex_unlock at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/port/esp32/freertos/sys_arch.c line 93
0x4015633c: lwip_ioctl_r at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/sockets.c line 3489
0x400d8981: WiFiClientRxBuffer::r_available() at C:.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp line 49
0x400d89e6: WiFiClientRxBuffer::fillBuffer() at C:.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp line 71
0x400d8a55: WiFiClientRxBuffer::read(unsigned char, unsigned int) at C:.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp line 107
0x400d8e96: WiFiClient::read(unsigned char
, unsigned int) at C:.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp line 437
0x4018afb6: WiFiClient::read() at C:.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFiClient.cpp line 345
0x400ea915: Stream::timedRead() at C:.platformio\packages\framework-arduinoespressif32\cores\esp32\Stream.cpp line 36
0x400ea9ad: Stream::readStringUntil(char) at C:.platformio\packages\framework-arduinoespressif32\cores\esp32\Stream.cpp line 330
0x400de266: WebServer::_parseRequest(WiFiClient&) at C:.platformio\packages\framework-arduinoespressif32\libraries\WebServer\src\Parsing.cpp line 78
0x400dc9e9: WebServer::handleClient() at C:.platformio\packages\framework-arduinoespressif32\libraries\WebServer\src\WebServer.cpp line 310
0x400d82e2: webserver_loop() at src\webserver_pro.cpp line 312
0x400d3b00: Task0code(void*) at src\main.cpp line 41
0x40089a76: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

but don't know how to fix.

it happens randomly. 1 day or several days.
dm5xx
@dm5xx
Hi all. I am reading an value continously in my code and writing it in a global varibal. in my server.on callback i am reading this value and returning it to the clients browser. for sure its crashing when i write it the same time.
Q1: how is the best way to avoid this (i am using a locked-variable at the moment).
Q2: since its async somehow, is there task scheduling and running on different cores@esp32 involved? Best way to exchange "data"/share aviables between "global code" and webserver(callbacks?
Hope im not mixing things too much - and sri for some rookie questening stuff :) Tnx for your support. M.
GitHub King
@HubKing

Can it handle multipart form? I browsed the readme, but the only thing I could find was multipart() that returns true/false. I want to know whether it can read values from a multipart POST. I confirmed that my POST code works correctly by posting it to https://httpbin.org/post; it returned

{
    "args": {}, 
    "data": "", 
    "files": {}, 
    "form": {
        "cat": "\u0001\u0002\u0000\u0003\u0004", 
        "dog": "hello"
    }, 
    "headers": {
        "Content-Length": "265", 
        "Content-Type": "multipart/form-data; boundary=\"8a9f2dc0-11a8-451a-9d5e-376624de7af7\"", 
        "Host": "httpbin.org",  .....

So, I want to get that "dog" and "cat" in my ESP. But when I listed all arguments using the readme code:

          //List all parameters (Compatibility)
          int args = request->args();
          for (int i = 0; i < args; i++)
          {
            Serial.printf("ARG[%s]: %s\n", request->argName(i).c_str(), request->arg(i).c_str());
          }

what I got was:

    ARG[o]: 
    ARG[a]: ␁␂

So, how can I get the string "hello" for the "dog" argument, and { 0x01, 0x02, 0x00, 0x03, 0x04 } for the "cat" argument? Is it supported? Any example?

5 replies
Also, it does not seem a good idea to use this chat site where everyone's posts are mixed together for "help and support" for the library. Github provides "Discussions" (for example: https://github.com/zadam/trilium/discussions ) which is a LOT better for this purpose, in my opinion. Why not use that instead?
Stephan H. Wissel
@Stwissel

How can I alter content based on a GET requests accept header?
I have a piece of code that looks like this:

server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/index.html", String(), false);
  });

which works as designed. However I need to send back different data, depending on the Accept header. Something like this:

server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
  if (request->contentType() == "application/json") {
         request->send(200, "text/json", String(publishData));
    } else {
    request->send(SPIFFS, "/index.html", String(), false);
  }});

Doesn't seem to work. What do I miss?

Open Source Hardware
@openedhardware
Hi!
Does anyone have similar issue with this? me-no-dev/ESPAsyncWebServer#435
I am running AP on my ESP32 and webserver from SPIFFS. I can connect to my webserver from my laptop(using wifi dongle), but cannot connect from my mobile phone.
Any idea to fix this?
Artonworks TM
@artonworkstm_gitlab

Hi!
I just couldn't find any working examples for TLS so I made an example sketch for TLS WebServer using this library.
Check it out here: https://gitlab.com/artonworkstm/asyncwebservertls

Also want to fasten up a bit the request process by caching sessions so there is no need to redo the whole handshake at every request.
Do you guys know how may I achieve that?
I found it in the ESP8266WiFi library that you can use there (tho I couldn't make it work).
The Session class is here at line 139: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/BearSSLHelpers.h

1 reply
chrgweber
@chrgweber
grafik.png
Hi!
I would like to serve following files as gzipped with the severStatic-method. Is this possible?
In the folder "fs" I have placed "all.min.css" and fonts from fontawesome. Do these files also have to be compressed in the folders?
My websever works fine most of the time. But rarely it crashes when an new client is involved. I use SPIFFS (data-directory)
for the files.
Cellie
@CelliesProjects
@chrgweber If you want to serve them gzipped then yes, they have to be gzipped. Also set the Content-Encoding: gzip header.
And Content-Type: application/javascript for jQuery.min
Diego Bonilla
@dieghobonilla
I have had no luck finding a websocket example using ESP32 as client, all the examples I found are with a web/browser based client, do you have any examples of creating a basic esp32 websocket client and server? thank you
István Horváth
@armogur_gitlab
@Stwissel
if (request->contentType().equals("application/json")) {

}
István Horváth
@armogur_gitlab
@openedhardware Are you trying with mDNS? Because it won't work on mobile browsers, you should use IP address.
Rocky
@softwarecrash
Hello, can anyone give me a hint about a little problem, i have splitet html code in progmem chars, and would send it, my way dont work, what is the right?
    server.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
              {
                request->send_P(200, "text/html", HTMLhead);
                request->send_P(200, "text/html", HTMLmain);
                request->send_P(200, "text/html", HTMLfoot);
              });
István Horváth
@armogur_gitlab
@softwarecrash Is this sends at least one part? like the HTMLhead? if so I would concatenate the three parts into one and send it that way.
Rocky
@softwarecrash
@armogur_gitlab yes, one part. its a website splittet in head, main contenct (or other content) and foot, head and foot i have seperated to reuse on other pages. the head etc is - "const char HTMLhead[] PROGMEM" type. i dont find a way to concate it without use a lot of memory
István Horváth
@armogur_gitlab
with size_t index as input parameter you can figure out where is the chunked response in the processing, though I not used this method, but looks like it will solve your problem
Rocky
@softwarecrash
@armogur_gitlab thanks, but have you another bigger sampele? i dont understand this code fragment in your link. sorry im not the pro in this things
Rocky
@softwarecrash
@armogur_gitlab can it be so simple? ti have found the print function, and testet, yeah it works, but is it right? looks too simple
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
{
AsyncResponseStream *response = request->beginResponseStream("text/html");
response->printf_P(HTMLhead);
response->printf_P(HTMLMain);
response->printf_P(HTMLfoot);
request->send(response);
});
Rocky
@softwarecrash
ok not so simple.... the processor doenst work, i cant replace things with vars
Rocky
@softwarecrash
printf_P(HTMLMain, processor); dont work in this scenario. any other practicable way to send variables with the request to prefill a dataform?
gecoool
@gecoool
Hello me-no-dev. I am stuck with ESPAsyncTCP ".pio\libdeps\esp12e\ESPAsyncTCP@src-4b2fa33d3d75d4541c5b044be255a09c\src/tcp_axtls.h:44:10: fatal error: include/ssl.h: No such file or directory". I made some researches but without luck. I am trying to make an SSL call to google sheet, but without success. Any pointers / ideas would be much appreciated, as this is a show stopper for my project. Thx !
DaeMonSx
@DaeMonSx
I am wondering, did anyone have problem with ESPAsyncWebServer or ESPAsyncTCP ? in regards to heap fragmentation?? First of all the bad String class, secondly, it seems i have major issue with heap fragmentation if using websocket.
me-no-dev : anykind of intention to replace the old arduino String class with std::string ? at least to have sso ..
István Horváth
@armogur_gitlab
@DaeMonSx I experienced this behaviour as well while running my microcontroller for days, I am rewriting the whole async tcp and its server counterparts to use char *
Mikey
@Mchaney3

Hi all. Fairly new and very sorry if answered as I've looked but I'm trying to use AsyncWebServer with SdFat and 128 GB exFAT SDHC. I'm having issues with the following lines in my code since I'm not using SD.h

request->send(SD, "/index.html", "text/html"); }); server.serveStatic("/", SD, "/");

I've tried changing SD to sd, and file objects without success. Also tried FS and fs with no luck. I'm fairly new and jsut not sure what filesystem to send from SdFat for request->send

Mike Dunston
@atanisoft
SdFat is not likely supported, at least on esp32 for sure as there is built-in SD/SDMMC support from the platform that does work.
Rainer Barth
@HobDev-RCB
I saw on VSCode / PlatformIO there is an update available from 1.2.7 (my installed version) to Version 2.1.0. But it is marked as incompatible. I have the latest esp8266 platform module version 3.2.0. Is it necessary to update and if so, how can I do it?
ESPAsyncWebServer_Version.png
NC700Rider
@NC700Rider
Hi all, I am a bit new on this ESPsyncWebServer. I am using ESPAsyncWebServer to be able to serve a JSON file to a client by using one API/end point. The client could modify the JSON and send back the JSON using other API/end point. I have managed to do it using a small JSON file. The file is included in the body of the request that the client sends to my ESP8266. The problem comes when the size of the JSON is bigger and the request's body gets the ESP8266 in chunks. I have checked the ESPAsyncWebServer documentation trying to figure out how to manage the chunks to be able to load in a String or even better, in the JSON doc that I use in my ESP8266.
Do you know how I can concat all the chunks (3 in my case) in a String or in a JSON?
Thank you in advanced
BBsan
@bbsan2k
Hey everyone,
@me-no-dev Thanks for your great lib 😊 I'm trying to migrate from "Stock" Webserver in arduino to ESPAsyncWebServer on an ESP32 project right now, as I need to use WebSockets for some functionality.
Unfortunately I cannot get the lib to build with ESP-IDF 4.4. It already fails when I try to include it.
Besides the CMakeLists format is still the "old" IDF style, I don't see any obvious issue.
I added the lib as a component, added AsyncTCP as a component and added arduino-esp as a component (within components/arduino).
Is there any point I'm missing?
BBsan
@bbsan2k
Never mind -.- forgot to add a requirement in my CMAKELists
Mike Dunston
@atanisoft
@bbsan2k If you are using IDF v4.4 I'd suggest looking at the IDF http_server component, I believe it also has built-in WS handling and has fewer restrictions on what you can/can't do within callbacks.
idolpx
@idolpx
Is there a way to flush an AsyncResponseStream if you are going to exceed the buffer size?
If my data is less than the buffer it gets sent fine but if it is bigger it gets truncated.
SamiHadjSaLem
@SamiHadjSaLem
Hi everyone ,how to solve this problem in the uploading : A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
István Horváth
@armogur_gitlab
interesting, maybe your browser can not connect to your EPS32, can this be like your microcontroller lost WIFI connection?
dm5xx
@dm5xx
Hi guys, i still have a problem - no idea what to do, heres again my question: I am reading an value continously in my main/loop-code and writing it in a global variabal. in my server.on callback/handler function i am reading this value and returning it to the clients browser. for sure its crashing when i write it the same time.
Q1: how is the best way to avoid this (i am using a locked-variable at the moment).
Q2: since its async somehow, is there task scheduling and running on different cores@esp32 involved? Best way to exchange "data"/share aviables between "global code" and webserver(callbacks?
Hope im not mixing things too much - and sri for some rookie questening stuff :) Tnx for your support. M.
Mehrdad K
@mkeyno

hi all
I made a couple of header file for different prepherals + header file for my asyncserver & asyncwebsocket

my_wifi.h

AsyncWebServer server(80);
AsyncWebSocket WS("/ws");

in other header file I have sensor to measure sumeting and send through websocket

my_sensor.h
WS.textAll(my_data);

but it can not see my WS instance error: 'WS' was not declared in this scope
does anyone know how can I pass my WS instance to other header files

DaeMonSx
@DaeMonSx

Hi guys, i still have a problem - no idea what to do, heres again my question: I am reading an value continously in my main/loop-code and writing it in a global variabal. in my server.on callback/handler function i am reading this value and returning it to the clients browser. for sure its crashing when i write it the same time.
Q1: how is the best way to avoid this (i am using a locked-variable at the moment).
Q2: since its async somehow, is there task scheduling and running on different cores@esp32 involved? Best way to exchange "data"/share aviables between "global code" and webserver(callbacks?
Hope im not mixing things too much - and sri for some rookie questening stuff :) Tnx for your support. M.

why not with websocket?

f0m3
@f0m3
Hey, is there any chance to have a socket.io server on esp8266?
Short problem description: There is a project thats all done in javascript. It uses a raspberry as socket.io server to do hardware things that a js client on a pc directs via socket.io. I cant really change the PC part but i want to replace the raspberry with esp8266 to scale prizes and make it "easier" to build.
but i cant find any resources for a socket.io server. Only clients everywhere.
István Horváth
@armogur_gitlab
@dm5xx maybe you should share your code
Mehrdad K
@mkeyno
hi All, I'm using the AsyncWebSocket on ESP32, and in the loop, I send the sensor data back to the page by simple code WS.text(WSclinet,data); however after a while _messageQueue.length() exceeded of maximum size and throw ERROR: Too many messages queued , does anyone know how to solve it