Elma
An event loop manager for embedded systems
|
An HTTP client for connecting to json services. More...
#include <client.h>
Public Member Functions | |
Client () | |
Client & | get (std::string url, std::function< void(json &)> handler) |
Client & | process_responses () |
std::pair< std::string, std::string > | url_parts (std::string url) |
int | num_responses () const |
An HTTP client for connecting to json services.
An example usage in a process
|
inline |
Client & elma::Client::get | ( | std::string | url, |
std::function< void(json &)> | handler | ||
) |
Send an HTTP GET request to a specific URL and register a handler to deal with the response. This method assumes the server will respond with a JSON string. This method is asynchronous and returns immediately.
url | The url, preceded by http:// or https:// |
handler | The handler, whose argument will be the json received from the request |
|
inline |
Client & elma::Client::process_responses | ( | ) |
std::pair< std::string, std::string > elma::Client::url_parts | ( | std::string | url | ) |