Open fanfanlatulipe26 opened 3 years ago
Thanks @fanfanlatulipe26 . We will take a look and consider implementation.
Status of this?
I just updated the code of the derivative class using WebServer:: send_P; was added.
Any progress here?
Hello, no progress. I'm adding this to next release and we will triage this and let you know about the resolution.
Great news!
I really need this, I need to answer a gigantic (100mb) text file that is dynamically generated from memory. With esp8266 I sent with sendContent_P a few lines at a time and it worked great. I can't do this with esp32. Thanks.
@AlefRosa In the mean time, why don't you use my trick I gave at the beginning: just include in your sketch a file fs_Webserver.h containing the code I gave above and declare you server as fs_Webserver. You can see the use in the project BaliseDGAC_GPS_Logger where you will find the file fs_Webserver.h and the server declaration and use in the .ino
Do you know how to use the RequestHandler (server->addHandler(new ... ) with your derived class?
Btw, the ESP32 Request handler uses different arguments fr its methods :(
An other missing method is:
void send(int code, const char *content_type, const char *content, size_t contentLength) Without, it uses an often superlfues strlen(), which is not optimal (esp with large content) Esp8266 has it.
Sorry, I never used RequestHandler . I had a look at the source code for RequestHandler .h and the ESP8266 version is really more C++ that the ESP32 one. I must admit that I am not C++ expert ... Didn't find any examples.
@fanfanlatulipe26 thank you very much, i got it yesterday. As I need to use asyncwebserver, I studied it further and managed to use request response using chunk method. thank you so much again! Now I'm managing to generate 10mb files from memory registers and send them in parts as I make them.
Also eagerly awaiting this important feature!
Thanks @fanfanlatulipe26 -- that code worked great. I had to add an additional constructor at the top:
fs_WebServer(IPAddress addr, int port): WebServer(addr, port){ }
Thanks @chconnor for the tip. I updated the code in the repository BaliseDGAC_GPS_Logger that I referenced above. It may help some one.
Thanks for sharing it is great for solving some issues in the progress of migration from esp8266 to esp32!!
Postponing to 3.1.0 Milestone, we will cover this during Webserver refactoring
Description:
webserver :Please add chunkedResponseModeStart / chunkedResponseFinalize These functions were added in a recent release for ESP8266WebServer and it will be nice to have them in the upcomming release for ESP32. If not , porting from ESP8266 to ESP32 becomes cumbersome. I developed a small derivated class to get them in rhe ESP32 environment. If it can help .....
Sketch: