Variables

@:value(cast "disconnect")@:enum@:implinlineread onlyDisconnect:ClusterEvent<Worker ‑> Void> = "disconnect"

Emitted after the worker IPC channel has disconnected.

This can occur when a worker exits gracefully, is killed, or is disconnected manually (such as with Worker.disconnect).

There may be a delay between the 'disconnect' and 'exit' events.

These events can be used to detect if the process is stuck in a cleanup or if there are long-living connections.

Listener arguments:

* worker:Worker

@:value(cast "exit")@:enum@:implinlineread onlyExit:ClusterEvent<(Worker, Int, String) ‑> Void> = "exit"

When any of the workers die the cluster module will emit the 'exit' event. This can be used to restart the worker by calling Cluster.fork again.

Listener arguments:

* worker:Worker
* code:Int - the exit code, if it exited normally.
* signal:String - the name of the signal (eg. 'SIGHUP') that caused the process to be killed.

@:value(cast "fork")@:enum@:implinlineread onlyFork:ClusterEvent<Worker ‑> Void> = "fork"

When a new worker is forked the cluster module will emit a 'fork' event. This can be used to log worker activity, and create your own timeout.

Listener arguments:

* worker:Worker

@:value(cast "listening")@:enum@:implinlineread onlyListening:ClusterEvent<(Worker, ListeningEventAddress) ‑> Void> = "listening"

After calling listen from a worker, when the 'listening' event is emitted on the server, a listening event will also be emitted on cluster in the master.

The event handler is executed with two arguments, the worker contains the worker object and the address object contains the following connection properties: address, port and addressType. This is very useful if the worker is listening on more than one address.

Listener arguments:

* worker:Worker
* address:ListeningEventAddress

@:value(cast "online")@:enum@:implinlineread onlyOnline:ClusterEvent<Worker ‑> Void> = "online"

After forking a new worker, the worker should respond with an online message. When the master receives an online message it will emit this event.

The difference between 'fork' and 'online' is that fork is emitted when the master forks a worker, and 'online' is emitted when the worker is running.

Listener arguments:

* worker:Worker

@:value(cast "setup")@:enum@:implinlineread onlySetup:ClusterEvent<ClusterSettings ‑> Void> = "setup"

Emitted the first time that Cluster.setupMaster is called.