Preview environment

class WorkerBootstrapper

export declare class WorkerBootstrapper

Utility class for bootstrapping a worker thread to be used for sharding

protectedreadonly
data : WorkerData

The data passed to the worker thread

protectedreadonly
shards : Collection<number, WebSocketShard>

The shards that are managed by this worker

bootstrap() : Promise<void>

Bootstraps the worker thread with the provided options

protected
connect(
shardId: number
) : Promise<void>

Helper method to initiate a shard's connection process

protected
destroy() : Promise<void>

Helper method to destroy a shard

protected
setupThreadEvents() : void

Helper method to attach event listeners to the parentPort