Agent
Extends: undici.Dispatcher
Agent allows dispatching requests against multiple different origins.
Requests are not guaranteed to be dispatched in order of invocation.
new undici.Agent([options])
new undici.Agent([options])Arguments:
options
AgentOptions(optional)
Returns: Agent
Parameter: AgentOptions
AgentOptionsExtends: PoolOptions
factory
(origin: URL, opts: Object) => Dispatcher- Default:(origin, opts) => new Pool(origin, opts)
Instance Properties
Agent.closed
Agent.closedImplements Client.closed
Agent.destroyed
Agent.destroyedImplements Client.destroyed
Instance Methods
Agent.close([callback])
Agent.close([callback])Implements Dispatcher.close([callback]).
Agent.destroy([error, callback])
Agent.destroy([error, callback])Implements Dispatcher.destroy([error, callback]).
Agent.dispatch(options, handler: AgentDispatchOptions)
Agent.dispatch(options, handler: AgentDispatchOptions)Implements Dispatcher.dispatch(options, handler).
Parameter: AgentDispatchOptions
AgentDispatchOptionsExtends: DispatchOptions
origin
string | URL
Implements Dispatcher.destroy([error, callback]).
Agent.connect(options[, callback])
Agent.connect(options[, callback])See Dispatcher.connect(options[, callback]).
Agent.dispatch(options, handler)
Agent.dispatch(options, handler)Implements Dispatcher.dispatch(options, handler).
Agent.pipeline(options, handler)
Agent.pipeline(options, handler)See Dispatcher.pipeline(options, handler).
Agent.request(options[, callback])
Agent.request(options[, callback])See Dispatcher.request(options [, callback]).
Agent.stream(options, factory[, callback])
Agent.stream(options, factory[, callback])See Dispatcher.stream(options, factory[, callback]).
Agent.upgrade(options[, callback])
Agent.upgrade(options[, callback])See Dispatcher.upgrade(options[, callback]).
Agent.stats()
Agent.stats()Returns an object of stats by origin in the format of Record<string, TClientStats | TPoolStats>
See PoolStats and ClientStats.
Last updated