Close the client. Closing will close down any pooled connections. Clients should always be closed after use.
Close the client. Closing will close down any pooled connections. Clients should always be closed after use.
Set a connection handler for the client. This handler is called when a new connection is established.
Whether the metrics are enabled for this measured object
Set a redirect handler for the http client.
The redirect handler is called when a 3xx
response is received and the request is configured to
follow redirects with {@link HttpClientRequest#setFollowRedirects}.
The redirect handler is passed the HttpClientResponse, it can return an HttpClientRequest or null
.
Future
is returned, the client will send this new request
The handler must return a Future
unsent so the client can further configure it and send it.
Create an HTTP request to send to the server. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the host
and port
. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the host
and port
. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the host
and default port. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the host
and default port. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the default host and port. The handler
is called when the request is ready to be sent.
Create an HTTP request to send to the server at the default host and port. The handler
is called when the request is ready to be sent.
Like {@link HttpClient#updateSSLOptions} but supplying a handler that will be called when the update happened (or has failed).
Like {@link HttpClient#updateSSLOptions} but supplying a handler that will be called when the update happened (or has failed).
Connect a WebSocket to the specified port, host and relative request URI
Connect a WebSocket to the specified port, host and relative request URI
Connect a WebSocket to the host and relative request URI and default port
Connect a WebSocket to the host and relative request URI and default port
Connect a WebSocket at the relative request URI using the default host and port
Connect a WebSocket at the relative request URI using the default host and port
Connect a WebSocket with the specified options.
Connect a WebSocket with the specified options.
Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols.
Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols.
Generated using TypeDoc
An asynchronous HTTP client.
It allows you to make requests to HTTP servers, and a single client can make requests to any server.
It also allows you to open WebSockets to servers.
The client can also pool HTTP connections.
For pooling to occur, keep-alive must be true on the HttpClientOptions (default is true). In this case connections will be pooled and re-used if there are pending HTTP requests waiting to get a connection, otherwise they will be closed.
This gives the benefits of keep alive when the client is loaded but means we don't keep connections hanging around unnecessarily when there would be no benefits anyway.
The client also supports pipe-lining of requests. Pipe-lining means another request is sent on the same connection before the response from the preceding one has returned. Pipe-lining is not appropriate for all requests.
To enable pipe-lining, it must be enabled on the HttpClientOptions (default is false).
When pipe-lining is enabled the connection will be automatically closed when all in-flight responses have returned and there are no outstanding pending requests to write.
The client is designed to be reused between requests.