Class: Master

workers~Master()

Master Represents the master process.

Constructor

new Master()

Create the master process.

Extends:
  • EventEmitter
Source:

Extends

  • EventEmitter

Methods

destroy()

Destroy the worker.

Source:

(private) handlePacket(packet)

Handle packet.

Parameters:
Name Type Description
packet Packet
Source:

(private) init()

Initialize master. Bind events.

Source:

listen()

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

Source:

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:

setEnv(env)

Set environment.

Parameters:
Name Type Description
env Object
Source:

write(data) → {Boolean}

Send data to worker.

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