Client
#include <icy/http/client.h>
class ClientDefined in src/http/include/icy/http/client.h:193
Friends
| Name | Description |
|---|---|
ClientConnection |
ClientConnection
friend class ClientConnectionDefined in src/http/include/icy/http/client.h:253
Public Attributes
| Return | Name | Description |
|---|---|---|
NullSignal | Shutdown |
Shutdown
NullSignal ShutdownType: NullSignal
Defined in src/http/include/icy/http/client.h:248
Public Methods
| Return | Name | Description |
|---|---|---|
Client | ||
~Client virtual | ||
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
Client()Defined in src/http/include/icy/http/client.h:196
~Client
virtual
virtual ~Client()Defined in src/http/include/icy/http/client.h:197
stop
void stop()Defined in src/http/include/icy/http/client.h:206
Stop the Client and close all connections.
createConnectionT
inline
template<class ConnectionT> inline ClientConnection::Ptr createConnectionT(const URL & url, uv::Loop * loop = uv::defaultLoop())Defined in src/http/include/icy/http/client.h:216
Creates and registers a typed client connection for the given URL. The connection type is inferred from the URL scheme (http, https, ws, wss).
Returns
Shared pointer to the created connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | const URL & | Target URL. The scheme determines the socket and adapter type. |
loop | uv::Loop * | Event loop to use. Defaults to the default libuv loop. |
createConnection
inline
inline ClientConnection::Ptr createConnection(const URL & url, uv::Loop * loop = uv::defaultLoop())Defined in src/http/include/icy/http/client.h:230
Creates and registers a ClientConnection for the given URL. The socket type is chosen based on the URL scheme (http/https/ws/wss).
Returns
Shared pointer to the created connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | const URL & | Target URL. |
loop | uv::Loop * | Event loop to use. Defaults to the default libuv loop. |
addConnection
virtual
virtual void addConnection(ClientConnection::Ptr conn)Defined in src/http/include/icy/http/client.h:241
Registers a connection with this client so it is tracked and cleaned up on stop().
Parameters
| Parameter | Type | Description |
|---|---|---|
conn | ClientConnection::Ptr | The connection to add. |
removeConnection
virtual
virtual void removeConnection(ClientConnection * conn)Defined in src/http/include/icy/http/client.h:246
Removes a previously registered connection from the client.
Parameters
| Parameter | Type | Description |
|---|---|---|
conn | ClientConnection * | Raw pointer to the connection to remove. |
Exceptions
| Exception | Description |
|---|---|
std::logic_error | if the connection is not tracked by this client. |
Public Static Methods
| Return | Name | Description |
|---|---|---|
Client & | instance static | Return the default HTTP Client singleton. |
void | destroy static | Destroys the default HTTP Client singleton. |
instance
static
static Client & instance()Defined in src/http/include/icy/http/client.h:200
Return the default HTTP Client singleton.
destroy
static
static void destroy()Defined in src/http/include/icy/http/client.h:203
Destroys the default HTTP Client singleton.
Protected Attributes
| Return | Name | Description |
|---|---|---|
ClientConnectionPtrVec | _connections |
_connections
ClientConnectionPtrVec _connectionsType: ClientConnectionPtrVec
Defined in src/http/include/icy/http/client.h:255
Protected Methods
| Return | Name | Description |
|---|---|---|
void | onConnectionClose |
onConnectionClose
void onConnectionClose(Connection & conn)