Espasyncwebserver pls explain format
Posted: Thu Sep 21, 2023 4:46 pm
Dear Forum
Got a webserver program running with Espasyncwebserver. Although the documentation is pretty elaborate I do have a question.
As per example I found elsewhere, I process some parameters and 'upload' these to the web page. The example uses a lot of String parameters. I'm old school C programmer, Strings have open ends, so I try to avoid using these and try to declare character pointers and reserve the memory for it. Now one of the snippets in most or all of the examples I find is:
The request->send has 5 parameters from which 4 I think I'm grasping:
LittleFS : The file is in the LittleFS flash
/index.html: Obviously the file you request form the flash
String() ??? Here's the one I cannot find in the documentation
false: Do not download but upload this file
processor: A redirect to a function that handles the variables.
So the one I am not grasping is 'String()'. What does it do? Why is it there? Is it to indicate the format the processor returns values? Can I use char() instead?
Hope you can help me. Thanks.
Got a webserver program running with Espasyncwebserver. Although the documentation is pretty elaborate I do have a question.
As per example I found elsewhere, I process some parameters and 'upload' these to the web page. The example uses a lot of String parameters. I'm old school C programmer, Strings have open ends, so I try to avoid using these and try to declare character pointers and reserve the memory for it. Now one of the snippets in most or all of the examples I find is:
Code: Select all
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(LittleFS, "/index.html", String(), false, processor);
});
LittleFS : The file is in the LittleFS flash
/index.html: Obviously the file you request form the flash
String() ??? Here's the one I cannot find in the documentation
false: Do not download but upload this file
processor: A redirect to a function that handles the variables.
So the one I am not grasping is 'String()'. What does it do? Why is it there? Is it to indicate the format the processor returns values? Can I use char() instead?
Hope you can help me. Thanks.