Class HttpClientFactory
A factory which creates HTTP clients.
[CLSCompliant(false)]
public abstract class HttpClientFactory
- Inheritance
-
HttpClientFactory
- Inherited Members
Constructors
HttpClientFactory()
protected HttpClientFactory()
Methods
CreateHttpClient(IClientConfig)
Create and configure an HttpClient.
public abstract HttpClient CreateHttpClient(IClientConfig clientConfig)
Parameters
clientConfig
IClientConfig
Returns
DisposeHttpClientsAfterUse(IClientConfig)
Determines if the SDK will dispose clients after they're used. If HttpClients are cached, either by the SDK or by your HttpClientFactory, this should be false. If there is no caching then this should be true.
public virtual bool DisposeHttpClientsAfterUse(IClientConfig clientConfig)
Parameters
clientConfig
IClientConfig
Returns
GetConfigUniqueString(IClientConfig)
Returns a string that's used to group equivalent HttpClients into caches. This method isn't used unless UseSDKHttpClientCaching returns true;
A null return value signals the SDK caching mechanism to cache HttpClients per SDK client. So when the SDK client is disposed, the HttpClients are as well.
A non-null return value signals the SDK that HttpClients created with the given clientConfig should be cached and reused globally. ClientConfigs that produce the same result for GetConfigUniqueString will be grouped together and considered equivalent for caching purposes.
public virtual string GetConfigUniqueString(IClientConfig clientConfig)
Parameters
clientConfig
IClientConfig
Returns
UseSDKHttpClientCaching(IClientConfig)
If true the SDK will internally cache the clients created by CreateHttpClient. If false the sdk will not cache the clients. Override this method to return false if your HttpClientFactory will handle its own caching or if you don't want clients to be cached.
public virtual bool UseSDKHttpClientCaching(IClientConfig clientConfig)
Parameters
clientConfig
IClientConfig