Class

SchedMsg

SchedMsg(worker)

SchedMsg is the class that will subscribe to receive commands from the scheduler. These commands could be used to reload the worker, or broacast a message.

SchedMsg extends the PropagatingEventEmitter. When a command is received from the scheduler, it will be emitted on the Schedsg instance. SchedMsg will register default handlers for these commands, but they can be overridden by listening for the event and returning false from callback you provide.

Constructor

# new SchedMsg(worker)

Parameters:
Name Type Description
worker Worker

Events

object

# announce

This command is an announcement from the scheduler, the provided message should be displayed to the user (modal on web, console on node).

Properties:
Name Type Description
message string

The message to be displayed to the user.

object

# kill

This command instructs the worker to immediately stop working, and can optionally disable the worker to prevent restarting. The user will need to manually intervene to restart the worker.

Properties:
Name Type Description
temporary boolean

When false, the worker will be disabled.

object

# openPopup

This web-only command will open a new webpage to the provided URL.

Properties:
Name Type Description
href string

The URL to open the new page to.

# reload

This command instructs the worker to "hard" reload, in the browser this will trigger a page refresh and in node it will exit the process.

object

# remove

This command instructs the worker to stop working on a specific job.

Properties:
Name Type Description
jobAddress string

The address of the job to stop working on.

# restart

This command instructs the worker to restart, e.g. call worker.stop() then worker.start().