Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
HttpClient Class Reference
Inheritance diagram for HttpClient:
rBootHttpUpdate

Public Member Functions

virtual ~HttpClient ()
 HttpClient destructor. More...
 
bool sendRequest (const Url &url, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, const String &body, RequestCompletedDelegate requestComplete)
 
bool downloadString (const Url &url, RequestCompletedDelegate requestComplete)
 
bool downloadFile (const Url &url, RequestCompletedDelegate requestComplete=nullptr)
 
bool downloadFile (const Url &url, const String &saveFileName, RequestCompletedDelegate requestComplete=nullptr)
 Queue request to download a file. More...
 
bool send (HttpRequest *request)
 
HttpRequestrequest (const String &url) SMING_DEPRECATED
 
HttpRequestcreateRequest (const Url &url)
 Helper function to create a new request on a URL. More...
 

Static Public Member Functions

static void cleanup ()
 

Protected Types

typedef ObjectMap< String, HttpClientConnectionHttpConnectionPool
 

Protected Member Functions

String getCacheKey (const Url &url)
 

Static Protected Attributes

static HttpConnectionPool httpConnectionPool
 

Constructor & Destructor Documentation

virtual HttpClient::~HttpClient ( )
inlinevirtual

HttpClient destructor.

Note
DON'T call cleanup. If you want to free all resources from HttpClients the correct sequence will be to
  1. Delete all instances of HttpClient
  2. Call the static method HttpClient::cleanup();

Member Function Documentation

static void HttpClient::cleanup ( )
inlinestatic

Use this method to clean all request queues and object pools

HttpRequest* HttpClient::createRequest ( const Url url)
inline

Helper function to create a new request on a URL.

Parameters
url
Return values
HttpRequest*
bool HttpClient::downloadFile ( const Url url,
const String saveFileName,
RequestCompletedDelegate  requestComplete = nullptr 
)

Queue request to download a file.

Parameters
urlSource of file data
saveFilenamePath to save file to. Optional: specify nullptr to use name from url
requestCompleteCompletion callback
HttpRequest* HttpClient::request ( const String url)
inline