Switchboard SDK
Loading...
Searching...
No Matches
switchboard::CURLNetworkClient Class Reference

Networking client to make HTTP requests. More...

#include <CURLNetworkClient.hpp>

Inheritance diagram for switchboard::CURLNetworkClient:
switchboard::NetworkClient

Public Member Functions

 CURLNetworkClient ()
 
 ~CURLNetworkClient ()
 
int post (const std::string &url, const std::vector< std::string > &headers, const std::string &body) override
 
NetworkResponseprocess () override
 
unsigned int getNumberOfPendingRequests () override
 
- Public Member Functions inherited from switchboard::NetworkClient

Detailed Description

Networking client to make HTTP requests.

CURLNetworkClient class.

Constructor & Destructor Documentation

◆ CURLNetworkClient()

switchboard::CURLNetworkClient::CURLNetworkClient ( )

Initializes the network client.

◆ ~CURLNetworkClient()

switchboard::CURLNetworkClient::~CURLNetworkClient ( )

Deinitializes the network client.

Member Function Documentation

◆ getNumberOfPendingRequests()

unsigned int switchboard::CURLNetworkClient::getNumberOfPendingRequests ( )
overridevirtual

Returns the number of pending requests.

Returns
The number of pending requests.

Implements switchboard::NetworkClient.

◆ post()

int switchboard::CURLNetworkClient::post ( const std::string & url,
const std::vector< std::string > & headers,
const std::string & body )
overridevirtual

Adds a post request to the queue.

Parameters
urlThe request url.
headersThe headers of the request.
bodyThe body of the request.
Returns
The id of the request, or 0 if the request could not be created.

Implements switchboard::NetworkClient.

◆ process()

NetworkResponse * switchboard::CURLNetworkClient::process ( )
overridevirtual

Processes currently active network requests in the queue. Should be periodically called from a single thread.

Returns
The response for last finished network request, nullptr if there is none.

Implements switchboard::NetworkClient.