Class: Master

workers.Master

new Master()

Represents the master process.

Source:

Methods

(private) _init()

Initialize master. Bind events.

Source:

(private) _initChildProcess()

Initialize master (node.js).

Source:

(private) _initWebWorkers()

Initialize master (web workers).

Source:

destroy()

Destroy the worker.

Source:

(private) handlePacket(packet)

Handle packet.

Parameters:
Name Type Description
packet Packet
Source:

listen(env) → {Master}

Listen for messages from master process (only if worker).

Parameters:
Name Type Description
env Object
Source:
Returns:
Type
Master

log(obj, …args)

Write a message to stdout in the master process.

Parameters:
Name Type Attributes Description
obj Object | String
args String <repeatable>
Source:

send(packet) → {Boolean}

Frame and send a packet.

Parameters:
Name Type Description
packet Packet
Source:
Returns:
Type
Boolean

sendEvent(event, …arg) → {Boolean}

Emit an event on the worker side.

Parameters:
Name Type Attributes Description
event String
arg Object <repeatable>
Source:
Returns:
Type
Boolean

set(network)

Set primary network.

Parameters:
Name Type Description
network NetworkType | Network
Source:

write(data) → {Boolean}

Send data to worker.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Boolean