WorkerShardingStrategy
export declare class WorkerShardingStrategy implements IShardingStrategy
export declare class WorkerShardingStrategy implements IShardingStrategy
Strategy used to spawn threads in worker_threads
Implements
IShardingStrategyconstructor(manager, options)
Constructs a new instance of the
WorkerShardingStrategy
className | Type | Optional | Description |
---|---|---|---|
manager | WebSocketManager | No | None |
options | WorkerShardingStrategyOptions | No | None |
connect()
:
Promise<void>
Initializes all the shards
destroy(options?)
:
Promise<void>
Destroys all the shards
Name | Type | Optional | Description |
---|---|---|---|
options | Omit<WebSocketShardDestroyOptions, 'recover'> | Yes | None |
Fetches the status of all the shards
send(shardId, data)
:
void
Sends a payload to a shard
Name | Type | Optional | Description |
---|---|---|---|
shardId | number | No | None |
data | GatewaySendPayload | No | None |
spawn(shardIds)
:
Promise<void>
Spawns all the shards
Name | Type | Optional | Description |
---|---|---|---|
shardIds | number[] | No | None |