Internal classes and inherited methods
These four classes are not exported through the package’s public import paths. This page helps SDK contributors follow the implementation and explains methods inherited by public classes. Applications should use the public classes and factories described in the reference index.TypedEmitter
Defined in src/events.ts. Constructor:new TypedEmitter<E>(onListenerError?), where E maps event names to payloads.
The optional callback receives a listener failure and its event name.
Client, GatewayClient, WorkerSupervisor, VoiceConnection, VoiceSession,
and VoicePlayer inherit these methods. The internal LiveKitTransport does too.
Async listeners are not awaited. Synchronous exceptions and rejected promises
are caught and passed to the configured listener-error callback.
Client and GatewayClient forward listener failures to their error event,
except failures inside an error listener. VoiceConnection and VoiceSession
forward them to the gateway’s error event. WorkerSupervisor, VoicePlayer,
and LiveKitTransport use the default callback, which discards listener failures;
handle failures within those listeners when they matter to your application.
emit() is public through inheritance, but emitting an event yourself does not
perform the corresponding network operation.
Resource
Abstract base class in src/resources.ts. Constructor:Resource<T>(data) for subclasses.
UserResource, Channel, Guild, GuildMember, Role, and Webhook inherit
these members. Webhook strips its token before calling the base constructor.
This class adds no network behaviour; actions live on its subclasses.
Semaphore
FIFO concurrency gate in src/scheduler.ts. Constructor:new Semaphore(capacity), where capacity is a positive integer.
The owner must call the release function after its work settles, generally in a
finally block. REST, upload, and shard startup code use this gate internally.
LiveKitTransport
Internal implementation ofVoiceTransport in
src/voice-livekit.ts. Created by liveKitAdapter()
after allocating a room. Constructor:
LiveKitTransport(room, options, dispose), where dispose releases encryption
resources owned by that attempt.
It inherits
on, once, emit, and removeAllListeners and translates room
events into the VoiceTransportEvents contract. Applications interact with it
through a VoiceConnection or VoiceSession.