class EE::Network::Http::Pool

Overview

HTTP Client Pool. More…

#include <http.hpp>

class Pool {
public:
    // construction

    Pool();
    Pool(const ConnectionPoolOptions& options);
    ~Pool();

    // methods

    static Pool& getGlobal();
    void clear();
    void close();
    void closeIdleConnections();
    bool exists(const URI& host, const URI& proxy = URI());
    std::shared_ptr<Http> get(const URI& host, const URI& proxy = URI());
};

Detailed Documentation

HTTP Client Pool. Will keep the instances of the HTTP clients until the Pool is destroyed. Acts as a host client cache.

Methods

static Pool& getGlobal()

Returns:

The reference to the global HTTP Pool A global HTTP Pool is created at the program start

void clear()

Cancel and clear all HTTP clients. Outside an HTTP callback this is an operation barrier. From a shared-pool callback, completion is deferred to avoid waiting for work queued behind the current callback.

void close()

Permanently closes this pool, cancelling work without joining workers. Safe for browser session teardown on the UI thread. Subsequent requests are cancelled.

void closeIdleConnections()

Closes idle connections without cancelling active requests.

bool exists(const URI& host, const URI& proxy = URI())

Parameters:

host

The scheme + hostname + port represented as an URI.

proxy

The client proxy if any, scheme + hostname + post as URI.

Returns:

True if the client already exists in the pool

std::shared_ptr<Http> get(const URI& host, const URI& proxy = URI())

Parameters:

host

The scheme + hostname + port represented as an URI.

proxy

The client proxy if any, scheme + hostname + post as URI.

Returns:

An HTTP Client to the host and proxy ( creates one if no one is found )