Search...

WorkerBootstrapper

export declare class WorkerBootstrapper 
export declare class WorkerBootstrapper 
Utility class for bootstrapping a worker thread to be used for sharding

constructor()

Constructs a new instance of the WorkerBootstrapper class
NameTypeOptionalDescription
Readonly
The data passed to the worker thread
Readonly

shards

:

Collection<number, WebSocketShard>

The shards that are managed by this worker

bootstrap(options?)

:

Promise<void>

Bootstraps the worker thread with the provided options
NameTypeOptionalDescription
optionsReadonly<BootstrapOptions>YesNone
Protected

connect(shardId)

:

Promise<void>

Helper method to initiate a shard's connection process
NameTypeOptionalDescription
shardIdnumberNoNone
Protected

destroy(shardId, options?)

:

Promise<void>

Helper method to destroy a shard
NameTypeOptionalDescription
shardIdnumberNoNone
optionsWebSocketShardDestroyOptionsYesNone
Protected

setupThreadEvents()

:

void

Helper method to attach event listeners to the parentPort