HttpClientPool
extends
HttpAsyncClient, HttpClient
in
A http client pool allows to send requests on a pool of different http client using a specific strategy (least used, round robin, ...).
Table of Contents
Methods
- addHttpClient() : void
- Add a client to the pool.
- sendAsyncRequest() : Promise
- Sends a PSR-7 request in an asynchronous way.
- sendRequest() : ResponseInterface
- Sends a PSR-7 request and returns a PSR-7 response.
Methods
addHttpClient()
Add a client to the pool.
public
addHttpClient(ClientInterface|HttpAsyncClient|HttpClientPoolItem $client) : void
Parameters
- $client : ClientInterface|HttpAsyncClient|HttpClientPoolItem
sendAsyncRequest()
Sends a PSR-7 request in an asynchronous way.
public
sendAsyncRequest(RequestInterface $request) : Promise
Exceptions related to processing the request are available from the returned Promise.
Parameters
- $request : RequestInterface
Tags
Return values
Promise —resolves a PSR-7 Response or fails with an Http\Client\Exception
sendRequest()
Sends a PSR-7 request and returns a PSR-7 response.
public
sendRequest(RequestInterface $request) : ResponseInterface
Parameters
- $request : RequestInterface