Skip to main content

WebClient

The WebClient class implements a lightweight HTTP/1.1 client for sending GET and POST requests over Socket, with optional support for SSL/TLS handshakes and proxy routing. It allows users to set timeouts, load certificates, and access response metadata such as status codes, headers, and content transfer encoding.

#include <network/webclient/include/TellusimWebClient.h>

Example

The following example demonstrates how to use WebClient to perform an HTTPS request with certificate validation:

WebClient client;

// client name
client.setName("Tellusim::WebClientSSL");

// connect client
if(!client.load("www/DigiCertCA.pem")) return false;
if(!client.connect(String("https://tellusim.com:443"))) return false;

// get response
Blob blob;
if(client.get(String("/")) && client.read(blob)) {
blob.seek(0);
TS_LOG(Message, blob.gets().get());
}