source: node_modules/undici/docs/api/Pool.md@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.7 KB
Line 
1# Class: Pool
2
3Extends: `undici.Dispatcher`
4
5A pool of [Client](Client.md) instances connected to the same upstream target.
6
7Requests are not guaranteed to be dispatched in order of invocation.
8
9## `new Pool(url[, options])`
10
11Arguments:
12
13* **url** `URL | string` - It should only include the **protocol, hostname, and port**.
14* **options** `PoolOptions` (optional)
15
16### Parameter: `PoolOptions`
17
18Extends: [`ClientOptions`](Client.md#parameter-clientoptions)
19
20* **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Client(origin, opts)`
21* **connections** `number | null` (optional) - Default: `null` - The number of `Client` instances to create. When set to `null`, the `Pool` instance will create an unlimited amount of `Client` instances.
22* **interceptors** `{ Pool: DispatchInterceptor[] } }` - Default: `{ Pool: [] }` - 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).
23
24## Instance Properties
25
26### `Pool.closed`
27
28Implements [Client.closed](Client.md#clientclosed)
29
30### `Pool.destroyed`
31
32Implements [Client.destroyed](Client.md#clientdestroyed)
33
34### `Pool.stats`
35
36Returns [`PoolStats`](PoolStats.md) instance for this pool.
37
38## Instance Methods
39
40### `Pool.close([callback])`
41
42Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
43
44### `Pool.destroy([error, callback])`
45
46Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
47
48### `Pool.connect(options[, callback])`
49
50See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
51
52### `Pool.dispatch(options, handler)`
53
54Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler).
55
56### `Pool.pipeline(options, handler)`
57
58See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
59
60### `Pool.request(options[, callback])`
61
62See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
63
64### `Pool.stream(options, factory[, callback])`
65
66See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
67
68### `Pool.upgrade(options[, callback])`
69
70See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
71
72## Instance Events
73
74### Event: `'connect'`
75
76See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect).
77
78### Event: `'disconnect'`
79
80See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect).
81
82### Event: `'drain'`
83
84See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain).
Note: See TracBrowser for help on using the repository browser.