Skip to content

ClusterHostOptions

Defined in: packages/sharding/src/host.ts:15

Options for a ClusterHost.

optional allowInsecure?: boolean

Defined in: packages/sharding/src/host.ts:24

Connect with ws:// to a coordinator on another machine, over a network you fully trust. Default false.


optional connectAttempts?: number

Defined in: packages/sharding/src/host.ts:48

Attempts connect() makes while the coordinator is busy (it answers “too many connections” or the hello timed out) before it gives up. Default 10. A refusal (bad secret, unknown or duplicate id) is final.


optional fork?: (script, env) => ChildProcess

Defined in: packages/sharding/src/host.ts:35

Starts a worker process. Defaults to child_process.fork().

string

Record<string, string | undefined>

ChildProcess


id: string

Defined in: packages/sharding/src/host.ts:28

This host’s ID: letters, digits, ., _, -. Must be unique in the deployment.


optional maxReconnectDelay?: number

Defined in: packages/sharding/src/host.ts:42

Longest delay between reconnect attempts, in ms. Default 30,000.


optional reconnectDelay?: number

Defined in: packages/sharding/src/host.ts:40

First delay before reconnecting, in ms. Default 1000.


script: string

Defined in: packages/sharding/src/host.ts:33

The worker script this host runs for every cluster. A coordinator cannot choose it: remote workers run only what the host owner configured.


secret: string

Defined in: packages/sharding/src/host.ts:26

The coordinator’s shared secret.


url: string | string[]

Defined in: packages/sharding/src/host.ts:22

The coordinator’s address: wss://host:port. ws:// is accepted for this machine, or anywhere with allowInsecure. A list names every coordinator of a deployment with a leader lock: the host tries them in turn, and moves to the next whenever one cannot be reached or drops it.