Search...

WorkerShardingStrategy

declare class WorkerShardingStrategy implements IShardingStrategy 
declare class WorkerShardingStrategy implements IShardingStrategy 
Strategy used to spawn threads in worker_threads

constructor(manager, options)

Constructs a new instance of the WorkerShardingStrategy class
NameTypeOptionalDescription
managerWebSocketManagerNoNone
optionsWorkerShardingStrategyOptionsNoNone

connect()

:

Promise<void>

Initializes all the shards

destroy(options?)

:

Promise<void>

Destroys all the shards
NameTypeOptionalDescription
optionsOmit<WebSocketShardDestroyOptions, 'recover'>YesNone

send(shardId, data)

:

void

Sends a payload to a shard
NameTypeOptionalDescription
shardIdnumberNoNone
dataGatewaySendPayloadNoNone

spawn(shardIds)

:

Promise<void>

Spawns all the shards
NameTypeOptionalDescription
shardIdsnumber[]NoNone