#include <icy/http/client.h>HTTP client for creating and managing outgoing connections.
| Return | Name | Description |
|---|---|---|
NullSignal | Shutdown |
NullSignal Shutdown| Return | Name | Description |
|---|---|---|
Client | ||
void | stop | Stop the Client and close all connections. |
ClientConnection::Ptr | createConnectionT inline | Creates and registers a typed client connection for the given URL. The connection type is inferred from the URL scheme (http, https, ws, wss). |
ClientConnection::Ptr | createConnection inline | Creates and registers a ClientConnection for the given URL. The socket type is chosen based on the URL scheme (http/https/ws/wss). |
void | addConnection virtual | Registers a connection with this client so it is tracked and cleaned up on stop(). |
void | removeConnection virtual | Removes a previously registered connection from the client. |
Client()void stop()Stop the Client and close all connections.
inline
template<class ConnectionT> inline ClientConnection::Ptr createConnectionT(const URL & url, uv::Loop * loop)Creates and registers a typed client connection for the given URL. The connection type is inferred from the URL scheme (http, https, ws, wss).
ConnectionT Concrete connection type derived from ClientConnection.url Target URL. The scheme determines the socket and adapter type.
loop Event loop to use. Defaults to the default libuv loop.
Shared pointer to the created connection.
inline
inline ClientConnection::Ptr createConnection(const URL & url, uv::Loop * loop)Creates and registers a ClientConnection for the given URL. The socket type is chosen based on the URL scheme (http/https/ws/wss).
url Target URL.
loop Event loop to use. Defaults to the default libuv loop.
Shared pointer to the created connection.
virtual
virtual void addConnection(ClientConnection::Ptr conn)Registers a connection with this client so it is tracked and cleaned up on stop().
conn The connection to add.virtual
virtual void removeConnection(ClientConnection * conn)Removes a previously registered connection from the client.
conn Raw pointer to the connection to remove.std::logic_error if the connection is not tracked by this client.| Return | Name | Description |
|---|---|---|
Client & | instance static | Return the default HTTP Client singleton. |
void | destroy static | Destroys the default HTTP Client singleton. |
static
static Client & instance()Return the default HTTP Client singleton.
static
static void destroy()Destroys the default HTTP Client singleton.
| Return | Name | Description |
|---|---|---|
ClientConnectionPtrVec | _connections |
ClientConnectionPtrVec _connections| Return | Name | Description |
|---|---|---|
void | onConnectionClose |
void onConnectionClose(Connection & conn)