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])

Arguments:

  • options AgentOptions (optional)

Returns: Agent

Parameter: AgentOptions

Extends: PoolOptionsarrow-up-right

  • factory (origin: URL, opts: Object) => Dispatcher - Default: (origin, opts) => new Pool(origin, opts)

Instance Properties

Agent.closed

Implements Client.closedarrow-up-right

Agent.destroyed

Implements Client.destroyedarrow-up-right

Instance Methods

Agent.close([callback])

Implements Dispatcher.close([callback])arrow-up-right.

Agent.destroy([error, callback])

Implements Dispatcher.destroy([error, callback])arrow-up-right.

Agent.dispatch(options, handler: AgentDispatchOptions)

Implements Dispatcher.dispatch(options, handler)arrow-up-right.

Parameter: AgentDispatchOptions

Extends: DispatchOptionsarrow-up-right

  • origin string | URL

Implements Dispatcher.destroy([error, callback])arrow-up-right.

Agent.connect(options[, callback])

See Dispatcher.connect(options[, callback])arrow-up-right.

Agent.dispatch(options, handler)

Implements Dispatcher.dispatch(options, handler)arrow-up-right.

Agent.pipeline(options, handler)

See Dispatcher.pipeline(options, handler)arrow-up-right.

Agent.request(options[, callback])

See Dispatcher.request(options [, callback])arrow-up-right.

Agent.stream(options, factory[, callback])

See Dispatcher.stream(options, factory[, callback])arrow-up-right.

Agent.upgrade(options[, callback])

See Dispatcher.upgrade(options[, callback])arrow-up-right.

Agent.stats()

Returns an object of stats by origin in the format of Record<string, TClientStats | TPoolStats>

See PoolStatsarrow-up-right and ClientStatsarrow-up-right.

Last updated