You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/choosing-a-client/readme.md
+2-35Lines changed: 2 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Choosing a Client
2
2
3
-
This guide explains how to choose between ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, direct ruby:`Protocol::HTTP::Request` handling, and higher-level interfaces for libraries.
3
+
This guide explains how to choose between ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, and higher-level interfaces for libraries.
4
4
5
-
ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, and `Protocol::HTTP` middleware use the same request and response model. The important differences are how destinations are selected, where connection settings are applied, and who owns the client life cycle.
5
+
ruby:`Async::HTTP::Internet` and ruby:`Async::HTTP::Client` use the same request and response model. The important differences are how destinations are selected, where connection settings are applied, and who owns the client life cycle.
6
6
7
7
## Quick Decision
8
8
@@ -11,7 +11,6 @@ ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, and `Protocol::HTTP` m
11
11
| Requests may target different origins and the defaults are suitable. | Shared ruby:`Async::HTTP::Internet`| Selects and reuses a client for each origin automatically. |
12
12
| Requests may target different origins, but need common client options or explicit ownership. | Explicit ruby:`Async::HTTP::Internet`| Applies the same options to each managed client and can be injected or closed early. |
13
13
| Requests repeatedly target one configured origin. | ruby:`Async::HTTP::Client`| Exposes the endpoint, protocol, retry, and connection-pool configuration directly. |
14
-
| A request is constructed separately or passed through middleware. | ruby:`Protocol::HTTP::Request` with `call`| Preserves the complete HTTP message across integration boundaries. |
15
14
| A library wraps one HTTP service directly. | Injected ruby:`Async::HTTP::Client` or `Protocol::HTTP` middleware | Leaves transport configuration, ownership, and testing under application control. |
16
15
| A library models an HTTP API as resources and representations. |[`async-rest`](https://socketry.github.io/async-rest/guides/getting-started/)| Provides higher-level API modeling over an injectable `Protocol::HTTP` delegate. |
17
16
| A library uses Faraday as its HTTP abstraction. |[`async-http-faraday`](https://socketry.github.io/async-http-faraday/guides/getting-started/)| Lets the application retain the Faraday interface while using `Async::HTTP` as the transport. |
@@ -163,35 +162,3 @@ end
163
162
164
163
putsStatusService.new(connection).healthy?
165
164
~~~
166
-
167
-
## Prepared Requests and Middleware
168
-
169
-
A ruby:`Protocol::HTTP::Request` is not another connection-management strategy. It is the complete HTTP message accepted by ruby:`Async::HTTP::Client#call` and by `Protocol::HTTP` middleware:
Construct requests directly when another component produces the message, when using middleware, or when sending a custom HTTP method without a convenience method. The client still determines the endpoint and manages the connections.
196
-
197
-
For direct, in-process middleware tests, see the [Testing guide](../testing/). For the complete message interface, see the [`protocol-http` Getting Started guide](https://socketry.github.io/protocol-http/guides/getting-started/).
0 commit comments