Client
Client
#include <icy/http/client.h>class ClientDefined in src/http/include/icy/http/client.h:192
HTTP client for creating and managing outgoing connections.
List of all members
| Name | Kind | Owner |
|---|---|---|
ClientConnection | friend | Declared here |
Shutdown | variable | Declared here |
Client | function | Declared here |
~Client | function | Declared here |
stop | function | Declared here |
createConnectionT | function | Declared here |
createConnection | function | Declared here |
addConnection | function | Declared here |
removeConnection | function | Declared here |
instance | function | Declared here |
destroy | function | Declared here |
_connections | variable | Declared here |
onConnectionClose | function | Declared here |
Friends
| Name | Description |
|---|---|
ClientConnection |
ClientConnection
friend class ClientConnectionDefined in src/http/include/icy/http/client.h:252
Public Attributes
| Return | Name | Description |
|---|---|---|
NullSignal | Shutdown |
Shutdown
NullSignal ShutdownDefined in src/http/include/icy/http/client.h:247
Public Methods
| 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
Client()Defined in src/http/include/icy/http/client.h:195
stop
void stop()Defined in src/http/include/icy/http/client.h:205
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:215
Creates and registers a typed client connection for the given URL. The connection type is inferred from the URL scheme (http, https, ws, wss).
Parameters
ConnectionTConcrete connection type derived from ClientConnection.
Parameters
urlTarget URL. The scheme determines the socket and adapter type.loopEvent loop to use. Defaults to the default libuv loop.
Returns
Shared pointer to the created connection.
createConnection
inline
inline ClientConnection::Ptr createConnection(const URL & url, uv::Loop * loop = uv::defaultLoop())Defined in src/http/include/icy/http/client.h:229
Creates and registers a ClientConnection for the given URL. The socket type is chosen based on the URL scheme (http/https/ws/wss).
Parameters
urlTarget URL.loopEvent loop to use. Defaults to the default libuv loop.
Returns
Shared pointer to the created connection.
addConnection
virtual
virtual void addConnection(ClientConnection::Ptr conn)Defined in src/http/include/icy/http/client.h:240
Registers a connection with this client so it is tracked and cleaned up on stop().
Parameters
connThe connection to add.
removeConnection
virtual
virtual void removeConnection(ClientConnection * conn)Defined in src/http/include/icy/http/client.h:245
Removes a previously registered connection from the client.
Parameters
connRaw pointer to the connection to remove.
Exceptions
std::logic_errorif 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:199
Return the default HTTP Client singleton.
destroy
static
static void destroy()Defined in src/http/include/icy/http/client.h:202
Destroys the default HTTP Client singleton.
Protected Attributes
| Return | Name | Description |
|---|---|---|
ClientConnectionPtrVec | _connections |
_connections
ClientConnectionPtrVec _connectionsDefined in src/http/include/icy/http/client.h:254
Protected Methods
| Return | Name | Description |
|---|---|---|
void | onConnectionClose |
onConnectionClose
void onConnectionClose(Connection & conn)