boblemaire/asyncHTTPrequest

How to use onData() ?

ersivv opened this issue · 1 comments

Hi.
How to use onData() callback function?

Take a look at the sample that I posted in response to issue #9. In that sample you could just as well use onData() instead of onReadyStateChange. Doing so would look like:

void requestCB(void* optParm, asyncHTTPrequest* request, int len){
        Serial.println(request->responseText());
        Serial.println();
        request->setDebug(false);
}

So you would not be looking for readyState == 4; The difference is that if it were a long or chunked response, there would be multiple calls to onData. The result in this case should be the same.