Understand the Dispatcher abstraction
mainThe Dispatcher class is the core abstraction used to dispatch HTTP requests in undici. It extends EventEmitter and defines the low-level dispatch() contract, as well as higher-level methods like request(), stream(), pipeline(), connect(), and upgrade().
Note that Dispatcher is an abstract class. You should not instantiate it directly; instead, instantiate concrete implementations such as Client, Pool, BalancedPool, or Agent. Calling dispatch(), close(), or destroy() on a base Dispatcher instance will throw Error: not implemented.
import { Dispatcher, Agent } from 'undici'
const dispatcher = new Agent()
console.log(dispatcher instanceof Dispatcher) // true