Method: Async::HTTP::Client#initialize
- Defined in:
- lib/async/http/client.rb
#initialize(endpoint, protocol = endpoint.protocol, scheme = endpoint.scheme, authority = endpoint.authority, retries: DEFAULT_RETRIES, connection_limit: DEFAULT_CONNECTION_LIMIT) ⇒ Client
Provides a robust interface to a server.
-
If there are no connections, it will create one.
-
If there are already connections, it will reuse it.
-
If a request fails, it will retry it up to N times if it was idempotent.
The client object will never become unusable. It internally manages persistent connections (or non-persistent connections if that’s required).
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/async/http/client.rb', line 48 def initialize(endpoint, protocol = endpoint.protocol, scheme = endpoint.scheme, = endpoint., retries: DEFAULT_RETRIES, connection_limit: DEFAULT_CONNECTION_LIMIT) @endpoint = endpoint @protocol = protocol @retries = retries @pool = make_pool(connection_limit) @scheme = scheme = end |