Extends: undici.Dispatcher
A pool of Client instances connected to the same upstream target.
Requests are not guaranteed to be dispatched in order of invocation.
new Pool(url, options?): voidArguments:
- url
URL | string- It should only include the protocol, hostname, and port. - options
PoolOptions(optional)
Extends: ClientOptions
- factory
(origin: URL, opts: Object) => Dispatcher- Default:(origin, opts) => new Client(origin, opts) - connections
number | null(optional) - Default:null- The number ofClientinstances to create. When set tonull, thePoolinstance will create an unlimited amount ofClientinstances. - clientTtl
number | null(optional) - Default:null- The amount of time before aClientinstance is removed from thePooland closed. When set tonull,Clientinstances will not be removed or closed based on age.
[!NOTE]
Poolinherits allClientOptions, includingallowH2(defaulttrue) andmaxConcurrentStreams(default100). With the unlimited default ofconnections,Poolwill open a newClient— and therefore a new TCP/TLS socket — per concurrent dispatch, which defeats HTTP/2 multiplexing on a shared session. To benefit from h2 multiplexing on a single session, capconnections(e.g.connections: 1) so that concurrent requests share a session up tomaxConcurrentStreams.
Implements Client.closed
Implements Client.destroyed
Returns PoolStats instance for this pool.
Pool.close(callback?): voidImplements Dispatcher.close([callback]).
Pool.destroy(error?, callback?): voidImplements Dispatcher.destroy([error, callback]).
Pool.connect(options, callback?): voidSee Dispatcher.connect(options[, callback]).
Pool.dispatch(options, handler): voidImplements Dispatcher.dispatch(options, handler).
Pool.pipeline(options, handler): voidSee Dispatcher.pipeline(options, handler).
Pool.request(options, callback?): voidSee Dispatcher.request(options [, callback]).
Pool.stream(options, factory, callback?): voidSee Dispatcher.stream(options, factory[, callback]).
Pool.upgrade(options, callback?): voidSee Dispatcher.upgrade(options[, callback]).
See Dispatcher Event: 'connect'.