Worker pool settings (count, log level/tags, RTC port range). Defaults to {}.
Logger for diagnostics. Defaults to a no-op logger.
Closes all workers and empties the pool. Respawning is disabled once closed.
Creates a mediasoup router on the least-loaded worker, incrementing that worker's load and decrementing it when the router closes.
mediasoup router options (media codecs).
The created mediasoup Router.
Synchronously invokes every listener registered for event, in registration order.
true if at least one listener was invoked, false if there were none.
The listener list is snapshotted before dispatch, so mutations made by handlers take effect only on subsequent emissions. Listeners are isolated: if one throws, the remaining listeners still run and the error is surfaced via console.error rather than swallowed silently (consistent with LocalMessageBus).
Returns the number of listeners currently registered for event.
The event name to count listeners for.
The count of registered listeners (0 if none).
Registers a listener that is invoked at most once: it is removed automatically before
being called the first time event is emitted.
This emitter, for chaining.
Remove a pending one-time listener by passing the same function reference to off.
Removes listeners for a single event, or for all events.
Optionalevent: keyof WorkerPoolEventsThe event name to clear; if omitted, listeners for every event are removed.
This emitter, for chaining.
Spawns the configured number of workers. Idempotent and safe against concurrent calls; returns once all workers are ready.
Server-side (mediasoup SFU) pool of worker subprocesses. Spawns one worker per logical CPU (by default), tracks each worker's router load, and assigns new routers to the least-loaded worker. Died workers are respawned automatically while the pool is running.
Remarks
Node-only; not usable in the browser. Managed internally by MediaService.