undici 6.21.0 → 7.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -46
- package/docs/docs/api/Agent.md +14 -17
- package/docs/docs/api/BalancedPool.md +16 -16
- package/docs/docs/api/CacheStore.md +131 -0
- package/docs/docs/api/Client.md +12 -14
- package/docs/docs/api/Debug.md +1 -1
- package/docs/docs/api/Dispatcher.md +98 -194
- package/docs/docs/api/EnvHttpProxyAgent.md +12 -13
- package/docs/docs/api/MockAgent.md +5 -3
- package/docs/docs/api/MockClient.md +5 -5
- package/docs/docs/api/MockPool.md +4 -3
- package/docs/docs/api/Pool.md +15 -16
- package/docs/docs/api/PoolStats.md +1 -1
- package/docs/docs/api/ProxyAgent.md +3 -3
- package/docs/docs/api/RedirectHandler.md +1 -1
- package/docs/docs/api/RetryAgent.md +1 -1
- package/docs/docs/api/RetryHandler.md +4 -4
- package/docs/docs/api/WebSocket.md +46 -4
- package/docs/docs/api/api-lifecycle.md +11 -11
- package/docs/docs/best-practices/mocking-request.md +2 -2
- package/docs/docs/best-practices/proxy.md +1 -1
- package/index.d.ts +1 -1
- package/index.js +23 -7
- package/lib/api/abort-signal.js +2 -0
- package/lib/api/api-connect.js +3 -1
- package/lib/api/api-pipeline.js +7 -6
- package/lib/api/api-request.js +33 -48
- package/lib/api/api-stream.js +39 -50
- package/lib/api/api-upgrade.js +5 -3
- package/lib/api/readable.js +235 -62
- package/lib/api/util.js +2 -0
- package/lib/cache/memory-cache-store.js +177 -0
- package/lib/cache/sqlite-cache-store.js +446 -0
- package/lib/core/constants.js +35 -10
- package/lib/core/diagnostics.js +122 -128
- package/lib/core/errors.js +6 -6
- package/lib/core/request.js +13 -11
- package/lib/core/symbols.js +2 -1
- package/lib/core/tree.js +9 -1
- package/lib/core/util.js +237 -49
- package/lib/dispatcher/agent.js +3 -17
- package/lib/dispatcher/balanced-pool.js +5 -8
- package/lib/dispatcher/client-h1.js +379 -134
- package/lib/dispatcher/client-h2.js +173 -107
- package/lib/dispatcher/client.js +19 -32
- package/lib/dispatcher/dispatcher-base.js +6 -35
- package/lib/dispatcher/dispatcher.js +7 -24
- package/lib/dispatcher/fixed-queue.js +91 -49
- package/lib/dispatcher/pool-stats.js +2 -0
- package/lib/dispatcher/pool.js +3 -6
- package/lib/dispatcher/proxy-agent.js +3 -6
- package/lib/handler/cache-handler.js +393 -0
- package/lib/handler/cache-revalidation-handler.js +124 -0
- package/lib/handler/decorator-handler.js +27 -0
- package/lib/handler/redirect-handler.js +54 -59
- package/lib/handler/retry-handler.js +77 -109
- package/lib/handler/unwrap-handler.js +96 -0
- package/lib/handler/wrap-handler.js +98 -0
- package/lib/interceptor/cache.js +350 -0
- package/lib/interceptor/dns.js +375 -0
- package/lib/interceptor/dump.js +2 -2
- package/lib/interceptor/redirect.js +11 -14
- package/lib/interceptor/response-error.js +18 -7
- package/lib/llhttp/constants.d.ts +97 -0
- package/lib/llhttp/constants.js +412 -192
- package/lib/llhttp/constants.js.map +1 -0
- package/lib/llhttp/llhttp-wasm.js +11 -1
- package/lib/llhttp/llhttp_simd-wasm.js +11 -1
- package/lib/llhttp/utils.d.ts +2 -0
- package/lib/llhttp/utils.js +9 -9
- package/lib/llhttp/utils.js.map +1 -0
- package/lib/mock/mock-agent.js +5 -8
- package/lib/mock/mock-client.js +9 -4
- package/lib/mock/mock-errors.js +3 -1
- package/lib/mock/mock-interceptor.js +8 -6
- package/lib/mock/mock-pool.js +9 -4
- package/lib/mock/mock-symbols.js +3 -1
- package/lib/mock/mock-utils.js +29 -5
- package/lib/util/cache.js +360 -0
- package/lib/web/cache/cache.js +24 -21
- package/lib/web/cache/cachestorage.js +1 -1
- package/lib/web/cookies/index.js +29 -14
- package/lib/web/cookies/parse.js +8 -3
- package/lib/web/eventsource/eventsource-stream.js +9 -8
- package/lib/web/eventsource/eventsource.js +10 -6
- package/lib/web/fetch/body.js +43 -41
- package/lib/web/fetch/constants.js +12 -5
- package/lib/web/fetch/data-url.js +3 -3
- package/lib/web/fetch/formdata-parser.js +72 -45
- package/lib/web/fetch/formdata.js +65 -54
- package/lib/web/fetch/headers.js +118 -86
- package/lib/web/fetch/index.js +58 -67
- package/lib/web/fetch/request.js +136 -77
- package/lib/web/fetch/response.js +87 -56
- package/lib/web/fetch/util.js +259 -109
- package/lib/web/fetch/webidl.js +113 -68
- package/lib/web/websocket/connection.js +76 -147
- package/lib/web/websocket/constants.js +70 -10
- package/lib/web/websocket/events.js +4 -2
- package/lib/web/websocket/frame.js +45 -3
- package/lib/web/websocket/receiver.js +29 -33
- package/lib/web/websocket/sender.js +18 -13
- package/lib/web/websocket/stream/websocketerror.js +83 -0
- package/lib/web/websocket/stream/websocketstream.js +485 -0
- package/lib/web/websocket/util.js +128 -77
- package/lib/web/websocket/websocket.js +234 -135
- package/package.json +24 -36
- package/scripts/strip-comments.js +3 -1
- package/types/agent.d.ts +7 -7
- package/types/api.d.ts +24 -24
- package/types/balanced-pool.d.ts +11 -11
- package/types/cache-interceptor.d.ts +172 -0
- package/types/client.d.ts +11 -12
- package/types/cookies.d.ts +2 -0
- package/types/diagnostics-channel.d.ts +10 -10
- package/types/dispatcher.d.ts +113 -90
- package/types/env-http-proxy-agent.d.ts +2 -2
- package/types/errors.d.ts +53 -47
- package/types/fetch.d.ts +17 -16
- package/types/formdata.d.ts +7 -7
- package/types/global-dispatcher.d.ts +4 -4
- package/types/global-origin.d.ts +5 -5
- package/types/handlers.d.ts +7 -7
- package/types/header.d.ts +157 -1
- package/types/index.d.ts +44 -46
- package/types/interceptors.d.ts +25 -8
- package/types/mock-agent.d.ts +21 -18
- package/types/mock-client.d.ts +4 -4
- package/types/mock-errors.d.ts +3 -3
- package/types/mock-interceptor.d.ts +19 -19
- package/types/mock-pool.d.ts +4 -4
- package/types/patch.d.ts +0 -4
- package/types/pool-stats.d.ts +8 -8
- package/types/pool.d.ts +12 -12
- package/types/proxy-agent.d.ts +4 -4
- package/types/readable.d.ts +18 -15
- package/types/retry-agent.d.ts +1 -1
- package/types/retry-handler.d.ts +10 -10
- package/types/util.d.ts +3 -3
- package/types/utility.d.ts +7 -0
- package/types/webidl.d.ts +44 -6
- package/types/websocket.d.ts +34 -1
- package/docs/docs/api/DispatchInterceptor.md +0 -60
- package/lib/interceptor/redirect-interceptor.js +0 -21
- package/lib/mock/pluralizer.js +0 -29
- package/lib/web/cache/symbols.js +0 -5
- package/lib/web/fetch/file.js +0 -126
- package/lib/web/fetch/symbols.js +0 -9
- package/lib/web/fileapi/encoding.js +0 -290
- package/lib/web/fileapi/filereader.js +0 -344
- package/lib/web/fileapi/progressevent.js +0 -78
- package/lib/web/fileapi/symbols.js +0 -10
- package/lib/web/fileapi/util.js +0 -391
- package/lib/web/websocket/symbols.js +0 -12
- package/types/file.d.ts +0 -39
- package/types/filereader.d.ts +0 -54
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# undici
|
|
2
2
|
|
|
3
|
-
[](https://github.com/nodejs/undici/actions/workflows/nodejs.yml) [](https://github.com/nodejs/undici/actions/workflows/nodejs.yml) [](https://github.com/neostandard/neostandard) [](https://badge.fury.io/js/undici) [](https://codecov.io/gh/nodejs/undici)
|
|
4
4
|
|
|
5
5
|
An HTTP/1.1 client, written from scratch for Node.js.
|
|
6
6
|
|
|
@@ -22,41 +22,26 @@ npm i undici
|
|
|
22
22
|
## Benchmarks
|
|
23
23
|
|
|
24
24
|
The benchmark is a simple getting data [example](https://github.com/nodejs/undici/blob/main/benchmarks/benchmark.js) using a
|
|
25
|
-
50 TCP connections with a pipelining depth of 10 running on Node
|
|
26
|
-
|
|
27
|
-
| _Tests_ | _Samples_ | _Result_ | _Tolerance_ | _Difference with slowest_ |
|
|
28
|
-
| :-----------------: | :-------: | :--------------: | :---------: | :-----------------------: |
|
|
29
|
-
| undici - fetch | 30 | 3704.43 req/sec | ± 2.95 % | - |
|
|
30
|
-
| http - no keepalive | 20 | 4275.30 req/sec | ± 2.60 % | + 15.41 % |
|
|
31
|
-
| node-fetch | 10 | 4759.42 req/sec | ± 0.87 % | + 28.48 % |
|
|
32
|
-
| request | 40 | 4803.37 req/sec | ± 2.77 % | + 29.67 % |
|
|
33
|
-
| axios | 45 | 4951.97 req/sec | ± 2.88 % | + 33.68 % |
|
|
34
|
-
| got | 10 | 5969.67 req/sec | ± 2.64 % | + 61.15 % |
|
|
35
|
-
| superagent | 10 | 9471.48 req/sec | ± 1.50 % | + 155.68 % |
|
|
36
|
-
| http - keepalive | 25 | 10327.49 req/sec | ± 2.95 % | + 178.79 % |
|
|
37
|
-
| undici - pipeline | 10 | 15053.41 req/sec | ± 1.63 % | + 306.36 % |
|
|
38
|
-
| undici - request | 10 | 19264.24 req/sec | ± 1.74 % | + 420.03 % |
|
|
39
|
-
| undici - stream | 15 | 20317.29 req/sec | ± 2.13 % | + 448.46 % |
|
|
40
|
-
| undici - dispatch | 10 | 24883.28 req/sec | ± 1.54 % | + 571.72 % |
|
|
41
|
-
|
|
42
|
-
The benchmark is a simple sending data [example](https://github.com/nodejs/undici/blob/main/benchmarks/post-benchmark.js) using a
|
|
43
|
-
50 TCP connections with a pipelining depth of 10 running on Node 20.10.0.
|
|
44
|
-
|
|
45
|
-
| _Tests_ | _Samples_ | _Result_ | _Tolerance_ | _Difference with slowest_ |
|
|
46
|
-
| :-----------------: | :-------: | :-------------: | :---------: | :-----------------------: |
|
|
47
|
-
| undici - fetch | 20 | 1968.42 req/sec | ± 2.63 % | - |
|
|
48
|
-
| http - no keepalive | 25 | 2330.30 req/sec | ± 2.99 % | + 18.38 % |
|
|
49
|
-
| node-fetch | 20 | 2485.36 req/sec | ± 2.70 % | + 26.26 % |
|
|
50
|
-
| got | 15 | 2787.68 req/sec | ± 2.56 % | + 41.62 % |
|
|
51
|
-
| request | 30 | 2805.10 req/sec | ± 2.59 % | + 42.50 % |
|
|
52
|
-
| axios | 10 | 3040.45 req/sec | ± 1.72 % | + 54.46 % |
|
|
53
|
-
| superagent | 20 | 3358.29 req/sec | ± 2.51 % | + 70.61 % |
|
|
54
|
-
| http - keepalive | 20 | 3477.94 req/sec | ± 2.51 % | + 76.69 % |
|
|
55
|
-
| undici - pipeline | 25 | 3812.61 req/sec | ± 2.80 % | + 93.69 % |
|
|
56
|
-
| undici - request | 10 | 6067.00 req/sec | ± 0.94 % | + 208.22 % |
|
|
57
|
-
| undici - stream | 10 | 6391.61 req/sec | ± 1.98 % | + 224.71 % |
|
|
58
|
-
| undici - dispatch | 10 | 6397.00 req/sec | ± 1.48 % | + 224.98 % |
|
|
25
|
+
50 TCP connections with a pipelining depth of 10 running on Node 22.11.0.
|
|
59
26
|
|
|
27
|
+
```
|
|
28
|
+
┌────────────────────────┬─────────┬────────────────────┬────────────┬─────────────────────────┐
|
|
29
|
+
│ Tests │ Samples │ Result │ Tolerance │ Difference with slowest │
|
|
30
|
+
├────────────────────────┼─────────┼────────────────────┼────────────┼─────────────────────────┤
|
|
31
|
+
│ 'axios' │ 15 │ '5708.26 req/sec' │ '± 2.91 %' │ '-' │
|
|
32
|
+
│ 'http - no keepalive' │ 10 │ '5809.80 req/sec' │ '± 2.30 %' │ '+ 1.78 %' │
|
|
33
|
+
│ 'request' │ 30 │ '5828.80 req/sec' │ '± 2.91 %' │ '+ 2.11 %' │
|
|
34
|
+
│ 'undici - fetch' │ 40 │ '5903.78 req/sec' │ '± 2.87 %' │ '+ 3.43 %' │
|
|
35
|
+
│ 'node-fetch' │ 10 │ '5945.40 req/sec' │ '± 2.13 %' │ '+ 4.15 %' │
|
|
36
|
+
│ 'got' │ 35 │ '6511.45 req/sec' │ '± 2.84 %' │ '+ 14.07 %' │
|
|
37
|
+
│ 'http - keepalive' │ 65 │ '9193.24 req/sec' │ '± 2.92 %' │ '+ 61.05 %' │
|
|
38
|
+
│ 'superagent' │ 35 │ '9339.43 req/sec' │ '± 2.95 %' │ '+ 63.61 %' │
|
|
39
|
+
│ 'undici - pipeline' │ 50 │ '13364.62 req/sec' │ '± 2.93 %' │ '+ 134.13 %' │
|
|
40
|
+
│ 'undici - stream' │ 95 │ '18245.36 req/sec' │ '± 2.99 %' │ '+ 219.63 %' │
|
|
41
|
+
│ 'undici - request' │ 50 │ '18340.17 req/sec' │ '± 2.84 %' │ '+ 221.29 %' │
|
|
42
|
+
│ 'undici - dispatch' │ 40 │ '22234.42 req/sec' │ '± 2.94 %' │ '+ 289.51 %' │
|
|
43
|
+
└────────────────────────┴─────────┴────────────────────┴────────────┴─────────────────────────┘
|
|
44
|
+
```
|
|
60
45
|
|
|
61
46
|
## Quick Start
|
|
62
47
|
|
|
@@ -127,13 +112,12 @@ Arguments:
|
|
|
127
112
|
* **options** [`RequestOptions`](./docs/docs/api/Dispatcher.md#parameter-requestoptions)
|
|
128
113
|
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
|
|
129
114
|
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
|
|
130
|
-
* **maxRedirections** `Integer` - Default: `0`
|
|
131
115
|
|
|
132
116
|
Returns a promise with the result of the `Dispatcher.request` method.
|
|
133
117
|
|
|
134
118
|
Calls `options.dispatcher.request(options)`.
|
|
135
119
|
|
|
136
|
-
See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](./examples/README.md) for examples.
|
|
120
|
+
See [Dispatcher.request](./docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback) for more details, and [request examples](./docs/examples/README.md) for examples.
|
|
137
121
|
|
|
138
122
|
### `undici.stream([url, options, ]factory): Promise`
|
|
139
123
|
|
|
@@ -143,7 +127,6 @@ Arguments:
|
|
|
143
127
|
* **options** [`StreamOptions`](./docs/docs/api/Dispatcher.md#parameter-streamoptions)
|
|
144
128
|
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
|
|
145
129
|
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
|
|
146
|
-
* **maxRedirections** `Integer` - Default: `0`
|
|
147
130
|
* **factory** `Dispatcher.stream.factory`
|
|
148
131
|
|
|
149
132
|
Returns a promise with the result of the `Dispatcher.stream` method.
|
|
@@ -160,7 +143,6 @@ Arguments:
|
|
|
160
143
|
* **options** [`PipelineOptions`](./docs/docs/api/Dispatcher.md#parameter-pipelineoptions)
|
|
161
144
|
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
|
|
162
145
|
* **method** `String` - Default: `PUT` if `options.body`, otherwise `GET`
|
|
163
|
-
* **maxRedirections** `Integer` - Default: `0`
|
|
164
146
|
* **handler** `Dispatcher.pipeline.handler`
|
|
165
147
|
|
|
166
148
|
Returns: `stream.Duplex`
|
|
@@ -178,7 +160,6 @@ Arguments:
|
|
|
178
160
|
* **url** `string | URL | UrlObject`
|
|
179
161
|
* **options** [`ConnectOptions`](./docs/docs/api/Dispatcher.md#parameter-connectoptions)
|
|
180
162
|
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
|
|
181
|
-
* **maxRedirections** `Integer` - Default: `0`
|
|
182
163
|
* **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
|
|
183
164
|
|
|
184
165
|
Returns a promise with the result of the `Dispatcher.connect` method.
|
|
@@ -234,7 +215,7 @@ A body can be of the following types:
|
|
|
234
215
|
- URLSearchParams
|
|
235
216
|
- FormData
|
|
236
217
|
|
|
237
|
-
In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard
|
|
218
|
+
In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard](https://fetch.spec.whatwg.org).
|
|
238
219
|
|
|
239
220
|
```js
|
|
240
221
|
import { fetch } from 'undici'
|
|
@@ -263,13 +244,13 @@ await fetch('http://example.com', { method: 'POST', body })
|
|
|
263
244
|
|
|
264
245
|
#### `request.duplex`
|
|
265
246
|
|
|
266
|
-
- half
|
|
247
|
+
- `'half'`
|
|
267
248
|
|
|
268
|
-
In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however,
|
|
249
|
+
In this implementation of fetch, `request.duplex` must be set if `request.body` is `ReadableStream` or `Async Iterables`, however, even though the value must be set to `'half'`, it is actually a _full_ duplex. For more detail refer to the [Fetch Standard](https://fetch.spec.whatwg.org/#dom-requestinit-duplex).
|
|
269
250
|
|
|
270
251
|
#### `response.body`
|
|
271
252
|
|
|
272
|
-
Nodejs has two kinds of streams: [web streams](https://nodejs.org/
|
|
253
|
+
Nodejs has two kinds of streams: [web streams](https://nodejs.org/api/webstreams.html), which follow the API of the WHATWG web standard found in browsers, and an older Node-specific [streams API](https://nodejs.org/api/stream.html). `response.body` returns a readable web stream. If you would prefer to work with a Node stream you can convert a web stream using `.fromWeb()`.
|
|
273
254
|
|
|
274
255
|
```js
|
|
275
256
|
import { fetch } from 'undici'
|
|
@@ -338,7 +319,6 @@ Arguments:
|
|
|
338
319
|
* **url** `string | URL | UrlObject`
|
|
339
320
|
* **options** [`UpgradeOptions`](./docs/docs/api/Dispatcher.md#parameter-upgradeoptions)
|
|
340
321
|
* **dispatcher** `Dispatcher` - Default: [getGlobalDispatcher](#undicigetglobaldispatcher)
|
|
341
|
-
* **maxRedirections** `Integer` - Default: `0`
|
|
342
322
|
* **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
|
|
343
323
|
|
|
344
324
|
Returns a promise with the result of the `Dispatcher.upgrade` method.
|
|
@@ -407,7 +387,8 @@ Refs: https://tools.ietf.org/html/rfc7231#section-5.1.1
|
|
|
407
387
|
### Pipelining
|
|
408
388
|
|
|
409
389
|
Undici will only use pipelining if configured with a `pipelining` factor
|
|
410
|
-
greater than `1`.
|
|
390
|
+
greater than `1`. Also it is important to pass `blocking: false` to the
|
|
391
|
+
request options to properly pipeline requests.
|
|
411
392
|
|
|
412
393
|
Undici always assumes that connections are persistent and will immediately
|
|
413
394
|
pipeline requests, without checking whether the connection is persistent.
|
package/docs/docs/api/Agent.md
CHANGED
|
@@ -16,65 +16,62 @@ Returns: `Agent`
|
|
|
16
16
|
|
|
17
17
|
### Parameter: `AgentOptions`
|
|
18
18
|
|
|
19
|
-
Extends: [`PoolOptions`](Pool.md#parameter-pooloptions)
|
|
19
|
+
Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions)
|
|
20
20
|
|
|
21
21
|
* **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)`
|
|
22
|
-
* **maxRedirections** `Integer` - Default: `0`. The number of HTTP redirection to follow unless otherwise specified in `DispatchOptions`.
|
|
23
|
-
* **interceptors** `{ Agent: DispatchInterceptor[] }` - Default: `[RedirectInterceptor]` - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time.
|
|
24
22
|
|
|
25
23
|
## Instance Properties
|
|
26
24
|
|
|
27
25
|
### `Agent.closed`
|
|
28
26
|
|
|
29
|
-
Implements [Client.closed](Client.md#clientclosed)
|
|
27
|
+
Implements [Client.closed](/docs/docs/api/Client.md#clientclosed)
|
|
30
28
|
|
|
31
29
|
### `Agent.destroyed`
|
|
32
30
|
|
|
33
|
-
Implements [Client.destroyed](Client.md#clientdestroyed)
|
|
31
|
+
Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed)
|
|
34
32
|
|
|
35
33
|
## Instance Methods
|
|
36
34
|
|
|
37
35
|
### `Agent.close([callback])`
|
|
38
36
|
|
|
39
|
-
Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
|
|
37
|
+
Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
|
|
40
38
|
|
|
41
39
|
### `Agent.destroy([error, callback])`
|
|
42
40
|
|
|
43
|
-
Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
41
|
+
Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
44
42
|
|
|
45
43
|
### `Agent.dispatch(options, handler: AgentDispatchOptions)`
|
|
46
44
|
|
|
47
|
-
Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
45
|
+
Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
48
46
|
|
|
49
47
|
#### Parameter: `AgentDispatchOptions`
|
|
50
48
|
|
|
51
|
-
Extends: [`DispatchOptions`](Dispatcher.md#parameter-dispatchoptions)
|
|
49
|
+
Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions)
|
|
52
50
|
|
|
53
51
|
* **origin** `string | URL`
|
|
54
|
-
* **maxRedirections** `Integer`.
|
|
55
52
|
|
|
56
|
-
Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
53
|
+
Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
57
54
|
|
|
58
55
|
### `Agent.connect(options[, callback])`
|
|
59
56
|
|
|
60
|
-
See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
|
|
57
|
+
See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
|
|
61
58
|
|
|
62
59
|
### `Agent.dispatch(options, handler)`
|
|
63
60
|
|
|
64
|
-
Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
61
|
+
Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
65
62
|
|
|
66
63
|
### `Agent.pipeline(options, handler)`
|
|
67
64
|
|
|
68
|
-
See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
65
|
+
See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
69
66
|
|
|
70
67
|
### `Agent.request(options[, callback])`
|
|
71
68
|
|
|
72
|
-
See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
|
|
69
|
+
See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
|
|
73
70
|
|
|
74
71
|
### `Agent.stream(options, factory[, callback])`
|
|
75
72
|
|
|
76
|
-
See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
73
|
+
See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
77
74
|
|
|
78
75
|
### `Agent.upgrade(options[, callback])`
|
|
79
76
|
|
|
80
|
-
See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
77
|
+
See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Extends: `undici.Dispatcher`
|
|
4
4
|
|
|
5
|
-
A pool of [Pool](Pool.md) instances connected to multiple upstreams.
|
|
5
|
+
A pool of [Pool](/docs/docs/api/Pool.md) instances connected to multiple upstreams.
|
|
6
6
|
|
|
7
7
|
Requests are not guaranteed to be dispatched in order of invocation.
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ Arguments:
|
|
|
15
15
|
|
|
16
16
|
### Parameter: `BalancedPoolOptions`
|
|
17
17
|
|
|
18
|
-
Extends: [`PoolOptions`](Pool.md#parameter-pooloptions)
|
|
18
|
+
Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions)
|
|
19
19
|
|
|
20
20
|
* **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)`
|
|
21
21
|
|
|
@@ -28,15 +28,15 @@ Returns an array of upstreams that were previously added.
|
|
|
28
28
|
|
|
29
29
|
### `BalancedPool.closed`
|
|
30
30
|
|
|
31
|
-
Implements [Client.closed](Client.md#clientclosed)
|
|
31
|
+
Implements [Client.closed](/docs/docs/api/Client.md#clientclosed)
|
|
32
32
|
|
|
33
33
|
### `BalancedPool.destroyed`
|
|
34
34
|
|
|
35
|
-
Implements [Client.destroyed](Client.md#clientdestroyed)
|
|
35
|
+
Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed)
|
|
36
36
|
|
|
37
37
|
### `Pool.stats`
|
|
38
38
|
|
|
39
|
-
Returns [`PoolStats`](PoolStats.md) instance for this pool.
|
|
39
|
+
Returns [`PoolStats`](/docs/docs/api/PoolStats.md) instance for this pool.
|
|
40
40
|
|
|
41
41
|
## Instance Methods
|
|
42
42
|
|
|
@@ -54,46 +54,46 @@ Removes an upstream that was previously added.
|
|
|
54
54
|
|
|
55
55
|
### `BalancedPool.close([callback])`
|
|
56
56
|
|
|
57
|
-
Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
|
|
57
|
+
Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
|
|
58
58
|
|
|
59
59
|
### `BalancedPool.destroy([error, callback])`
|
|
60
60
|
|
|
61
|
-
Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
61
|
+
Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
62
62
|
|
|
63
63
|
### `BalancedPool.connect(options[, callback])`
|
|
64
64
|
|
|
65
|
-
See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
|
|
65
|
+
See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
|
|
66
66
|
|
|
67
67
|
### `BalancedPool.dispatch(options, handlers)`
|
|
68
68
|
|
|
69
|
-
Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
69
|
+
Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
70
70
|
|
|
71
71
|
### `BalancedPool.pipeline(options, handler)`
|
|
72
72
|
|
|
73
|
-
See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
73
|
+
See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
74
74
|
|
|
75
75
|
### `BalancedPool.request(options[, callback])`
|
|
76
76
|
|
|
77
|
-
See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
|
|
77
|
+
See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
|
|
78
78
|
|
|
79
79
|
### `BalancedPool.stream(options, factory[, callback])`
|
|
80
80
|
|
|
81
|
-
See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
81
|
+
See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
82
82
|
|
|
83
83
|
### `BalancedPool.upgrade(options[, callback])`
|
|
84
84
|
|
|
85
|
-
See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
85
|
+
See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
86
86
|
|
|
87
87
|
## Instance Events
|
|
88
88
|
|
|
89
89
|
### Event: `'connect'`
|
|
90
90
|
|
|
91
|
-
See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect).
|
|
91
|
+
See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect).
|
|
92
92
|
|
|
93
93
|
### Event: `'disconnect'`
|
|
94
94
|
|
|
95
|
-
See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect).
|
|
95
|
+
See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect).
|
|
96
96
|
|
|
97
97
|
### Event: `'drain'`
|
|
98
98
|
|
|
99
|
-
See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain).
|
|
99
|
+
See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain).
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Cache Store
|
|
2
|
+
|
|
3
|
+
A Cache Store is responsible for storing and retrieving cached responses.
|
|
4
|
+
It is also responsible for deciding which specific response to use based off of
|
|
5
|
+
a response's `Vary` header (if present). It is expected to be compliant with
|
|
6
|
+
[RFC-9111](https://www.rfc-editor.org/rfc/rfc9111.html).
|
|
7
|
+
|
|
8
|
+
## Pre-built Cache Stores
|
|
9
|
+
|
|
10
|
+
### `MemoryCacheStore`
|
|
11
|
+
|
|
12
|
+
The `MemoryCacheStore` stores the responses in-memory.
|
|
13
|
+
|
|
14
|
+
**Options**
|
|
15
|
+
|
|
16
|
+
- `maxCount` - The maximum amount of responses to store. Default `Infinity`.
|
|
17
|
+
- `maxEntrySize` - The maximum size in bytes that a response's body can be. If a response's body is greater than or equal to this, the response will not be cached.
|
|
18
|
+
|
|
19
|
+
### `SqliteCacheStore`
|
|
20
|
+
|
|
21
|
+
The `SqliteCacheStore` stores the responses in a SQLite database.
|
|
22
|
+
Under the hood, it uses Node.js' [`node:sqlite`](https://nodejs.org/api/sqlite.html) api.
|
|
23
|
+
The `SqliteCacheStore` is only exposed if the `node:sqlite` api is present.
|
|
24
|
+
|
|
25
|
+
**Options**
|
|
26
|
+
|
|
27
|
+
- `location` - The location of the SQLite database to use. Default `:memory:`.
|
|
28
|
+
- `maxCount` - The maximum number of entries to store in the database. Default `Infinity`.
|
|
29
|
+
- `maxEntrySize` - The maximum size in bytes that a resposne's body can be. If a response's body is greater than or equal to this, the response will not be cached. Default `Infinity`.
|
|
30
|
+
|
|
31
|
+
## Defining a Custom Cache Store
|
|
32
|
+
|
|
33
|
+
The store must implement the following functions:
|
|
34
|
+
|
|
35
|
+
### Getter: `isFull`
|
|
36
|
+
|
|
37
|
+
Optional. This tells the cache interceptor if the store is full or not. If this is true,
|
|
38
|
+
the cache interceptor will not attempt to cache the response.
|
|
39
|
+
|
|
40
|
+
### Function: `get`
|
|
41
|
+
|
|
42
|
+
Parameters:
|
|
43
|
+
|
|
44
|
+
* **req** `Dispatcher.RequestOptions` - Incoming request
|
|
45
|
+
|
|
46
|
+
Returns: `GetResult | Promise<GetResult | undefined> | undefined` - If the request is cached, the cached response is returned. If the request's method is anything other than HEAD, the response is also returned.
|
|
47
|
+
If the request isn't cached, `undefined` is returned.
|
|
48
|
+
|
|
49
|
+
Response properties:
|
|
50
|
+
|
|
51
|
+
* **response** `CacheValue` - The cached response data.
|
|
52
|
+
* **body** `Readable | undefined` - The response's body.
|
|
53
|
+
|
|
54
|
+
### Function: `createWriteStream`
|
|
55
|
+
|
|
56
|
+
Parameters:
|
|
57
|
+
|
|
58
|
+
* **req** `Dispatcher.RequestOptions` - Incoming request
|
|
59
|
+
* **value** `CacheValue` - Response to store
|
|
60
|
+
|
|
61
|
+
Returns: `Writable | undefined` - If the store is full, return `undefined`. Otherwise, return a writable so that the cache interceptor can stream the body and trailers to the store.
|
|
62
|
+
|
|
63
|
+
## `CacheValue`
|
|
64
|
+
|
|
65
|
+
This is an interface containing the majority of a response's data (minus the body).
|
|
66
|
+
|
|
67
|
+
### Property `statusCode`
|
|
68
|
+
|
|
69
|
+
`number` - The response's HTTP status code.
|
|
70
|
+
|
|
71
|
+
### Property `statusMessage`
|
|
72
|
+
|
|
73
|
+
`string` - The response's HTTP status message.
|
|
74
|
+
|
|
75
|
+
### Property `rawHeaders`
|
|
76
|
+
|
|
77
|
+
`Buffer[]` - The response's headers.
|
|
78
|
+
|
|
79
|
+
### Property `vary`
|
|
80
|
+
|
|
81
|
+
`Record<string, string | string[]> | undefined` - The headers defined by the response's `Vary` header
|
|
82
|
+
and their respective values for later comparison
|
|
83
|
+
|
|
84
|
+
For example, for a response like
|
|
85
|
+
```
|
|
86
|
+
Vary: content-encoding, accepts
|
|
87
|
+
content-encoding: utf8
|
|
88
|
+
accepts: application/json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This would be
|
|
92
|
+
```js
|
|
93
|
+
{
|
|
94
|
+
'content-encoding': 'utf8',
|
|
95
|
+
accepts: 'application/json'
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Property `cachedAt`
|
|
100
|
+
|
|
101
|
+
`number` - Time in millis that this value was cached.
|
|
102
|
+
|
|
103
|
+
### Property `staleAt`
|
|
104
|
+
|
|
105
|
+
`number` - Time in millis that this value is considered stale.
|
|
106
|
+
|
|
107
|
+
### Property `deleteAt`
|
|
108
|
+
|
|
109
|
+
`number` - Time in millis that this value is to be deleted from the cache. This
|
|
110
|
+
is either the same sa staleAt or the `max-stale` caching directive.
|
|
111
|
+
|
|
112
|
+
The store must not return a response after the time defined in this property.
|
|
113
|
+
|
|
114
|
+
## `CacheStoreReadable`
|
|
115
|
+
|
|
116
|
+
This extends Node's [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable)
|
|
117
|
+
and defines extra properties relevant to the cache interceptor.
|
|
118
|
+
|
|
119
|
+
### Getter: `value`
|
|
120
|
+
|
|
121
|
+
The response's [`CacheStoreValue`](/docs/docs/api/CacheStore.md#cachestorevalue)
|
|
122
|
+
|
|
123
|
+
## `CacheStoreWriteable`
|
|
124
|
+
|
|
125
|
+
This extends Node's [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable)
|
|
126
|
+
and defines extra properties relevant to the cache interceptor.
|
|
127
|
+
|
|
128
|
+
### Setter: `rawTrailers`
|
|
129
|
+
|
|
130
|
+
If the response has trailers, the cache interceptor will pass them to the cache
|
|
131
|
+
interceptor through this method.
|
package/docs/docs/api/Client.md
CHANGED
|
@@ -19,7 +19,7 @@ Returns: `Client`
|
|
|
19
19
|
|
|
20
20
|
> ⚠️ Warning: The `H2` support is experimental.
|
|
21
21
|
|
|
22
|
-
* **bodyTimeout** `number | null` (optional) - Default: `300e3` - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. Please note the `timeout` will be reset if you keep writing data to the
|
|
22
|
+
* **bodyTimeout** `number | null` (optional) - Default: `300e3` - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. Please note the `timeout` will be reset if you keep writing data to the socket everytime.
|
|
23
23
|
* **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
|
|
24
24
|
* **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Defaults to 10 minutes.
|
|
25
25
|
* **keepAliveTimeout** `number | null` (optional) - Default: `4e3` - The timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. Defaults to 4 seconds.
|
|
@@ -29,8 +29,6 @@ Returns: `Client`
|
|
|
29
29
|
* **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
|
|
30
30
|
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
|
|
31
31
|
* **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body.
|
|
32
|
-
<!-- TODO: Remove once we drop its support -->
|
|
33
|
-
* **interceptors** `{ Client: DispatchInterceptor[] }` - Default: `[RedirectInterceptor]` - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time. **Note: this is deprecated in favor of [Dispatcher#compose](./Dispatcher.md#dispatcher). Support will be droped in next major.**
|
|
34
32
|
* **autoSelectFamily**: `boolean` (optional) - Default: depends on local Node version, on Node 18.13.0 and above is `false`. Enables a family autodetection algorithm that loosely implements section 5 of [RFC 8305](https://tools.ietf.org/html/rfc8305#section-5). See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details. This option is ignored if not supported by the current Node version.
|
|
35
33
|
* **autoSelectFamilyAttemptTimeout**: `number` - Default: depends on local Node version, on Node 18.13.0 and above is `250`. The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details.
|
|
36
34
|
* **allowH2**: `boolean` - Default: `false`. Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
@@ -88,37 +86,37 @@ const client = new Client('https://localhost:3000', {
|
|
|
88
86
|
|
|
89
87
|
### `Client.close([callback])`
|
|
90
88
|
|
|
91
|
-
Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
|
|
89
|
+
Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise).
|
|
92
90
|
|
|
93
91
|
### `Client.destroy([error, callback])`
|
|
94
92
|
|
|
95
|
-
Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
93
|
+
Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise).
|
|
96
94
|
|
|
97
95
|
Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided).
|
|
98
96
|
|
|
99
97
|
### `Client.connect(options[, callback])`
|
|
100
98
|
|
|
101
|
-
See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
|
|
99
|
+
See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback).
|
|
102
100
|
|
|
103
101
|
### `Client.dispatch(options, handlers)`
|
|
104
102
|
|
|
105
|
-
Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
103
|
+
Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler).
|
|
106
104
|
|
|
107
105
|
### `Client.pipeline(options, handler)`
|
|
108
106
|
|
|
109
|
-
See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
107
|
+
See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler).
|
|
110
108
|
|
|
111
109
|
### `Client.request(options[, callback])`
|
|
112
110
|
|
|
113
|
-
See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
|
|
111
|
+
See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback).
|
|
114
112
|
|
|
115
113
|
### `Client.stream(options, factory[, callback])`
|
|
116
114
|
|
|
117
|
-
See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
115
|
+
See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback).
|
|
118
116
|
|
|
119
117
|
### `Client.upgrade(options[, callback])`
|
|
120
118
|
|
|
121
|
-
See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
119
|
+
See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback).
|
|
122
120
|
|
|
123
121
|
## Instance Properties
|
|
124
122
|
|
|
@@ -144,7 +142,7 @@ Property to get and set the pipelining factor.
|
|
|
144
142
|
|
|
145
143
|
### Event: `'connect'`
|
|
146
144
|
|
|
147
|
-
See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect).
|
|
145
|
+
See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect).
|
|
148
146
|
|
|
149
147
|
Parameters:
|
|
150
148
|
|
|
@@ -190,7 +188,7 @@ try {
|
|
|
190
188
|
|
|
191
189
|
### Event: `'disconnect'`
|
|
192
190
|
|
|
193
|
-
See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect).
|
|
191
|
+
See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect).
|
|
194
192
|
|
|
195
193
|
Parameters:
|
|
196
194
|
|
|
@@ -235,7 +233,7 @@ try {
|
|
|
235
233
|
|
|
236
234
|
Emitted when pipeline is no longer busy.
|
|
237
235
|
|
|
238
|
-
See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain).
|
|
236
|
+
See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain).
|
|
239
237
|
|
|
240
238
|
#### Example - Client drain event
|
|
241
239
|
|