This repository was archived by the owner on Jan 20, 2025. It is now read-only.
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
How to use the async client? #18
Closed
Description
My current code, which actually not works....
AsyncClient async_client;
.
.
.
String req ;
int8_t connected = async_client.connected();
Serial.print("connected: ");
Serial.println(connected) ;
if (!connected ) {
Serial.println("connecting..") ;
async_client.connect("192.168.0.17", 80);
}
else {
String req = "POST /data HTTP/1.1 \nHost: " ;
req += config_data.host_ip ;
req += "/data" ;
req += "\nCache-Control: no-cache \nContent-Type: application/json \nContent-Length: ";
req += payload.length() ;
req += "\nAccept: */*\n";
req += payload.c_str() ;
Serial.println(req);
if ( async_client.canSend()) {
async_client.add(req.c_str(), req.length() );
bool sent = async_client.send();
async_client.close();
Serial.print("sent...") ;
Serial.println(sent) ;
}
}
What is missing? How to make it work? HEEEELP PLEEASE!!
Metadata
Metadata
Assignees
Labels
No labels