me-no-dev / ESPAsyncWebServer

Async Web Server for ESP8266 and ESP32
3.78k stars 1.23k forks source link

Send content with beginChunkedResponse #1405

Closed minou65 closed 6 months ago

minou65 commented 6 months ago

Hi all I need your help I tring do send content with this function ` void sendContent(const String& content) override {

    AsyncWebServerResponse* response = this->_request->beginChunkedResponse("text/plain", [content](uint8_t* buffer, size_t maxlen, size_t index) -> size_t {
        if (index < content.length()) {
            size_t toCopy = content.length();
            memcpy(buffer, content.c_str() + index, toCopy);
            return toCopy;
        }
        else {
            return 0; // No more data to send
        }
    });
    _request->send(response);
};`

I to not recive any error, but the also on the webpage nothing is thre can you help?