11cb0ef41Sopenharmony_ci# Class: Pool
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciExtends: `undici.Dispatcher`
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciA pool of [Client](Client.md) instances connected to the same upstream target.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciRequests are not guaranteed to be dispatched in order of invocation.
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci## `new Pool(url[, options])`
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciArguments:
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci* **url** `URL | string` - It should only include the **protocol, hostname, and port**.
141cb0ef41Sopenharmony_ci* **options** `PoolOptions` (optional)
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci### Parameter: `PoolOptions`
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciExtends: [`ClientOptions`](Client.md#parameter-clientoptions)
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci* **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Client(origin, opts)`
211cb0ef41Sopenharmony_ci* **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.
221cb0ef41Sopenharmony_ci* **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).
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci## Instance Properties
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci### `Pool.closed`
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ciImplements [Client.closed](Client.md#clientclosed)
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci### `Pool.destroyed`
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciImplements [Client.destroyed](Client.md#clientdestroyed)
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci### `Pool.stats`
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ciReturns [`PoolStats`](PoolStats.md) instance for this pool.
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci## Instance Methods
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci### `Pool.close([callback])`
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ciImplements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci### `Pool.destroy([error, callback])`
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ciImplements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci### `Pool.connect(options[, callback])`
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ciSee [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci### `Pool.dispatch(options, handler)`
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ciImplements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler).
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci### `Pool.pipeline(options, handler)`
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ciSee [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ci### `Pool.request(options[, callback])`
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ciSee [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ci### `Pool.stream(options, factory[, callback])`
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ciSee [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ci### `Pool.upgrade(options[, callback])`
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ciSee [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ci## Instance Events
731cb0ef41Sopenharmony_ci
741cb0ef41Sopenharmony_ci### Event: `'connect'`
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ciSee [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect).
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ci### Event: `'disconnect'`
791cb0ef41Sopenharmony_ci
801cb0ef41Sopenharmony_ciSee [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect).
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ci### Event: `'drain'`
831cb0ef41Sopenharmony_ci
841cb0ef41Sopenharmony_ciSee [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain).
85