Messenger

Messenger

Communication between app worker and agent worker with EventEmitter

Constructor

new Messenger()

Source:

Methods

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

sendRandom(action, data) → {Messenger}

send message to one worker by random Notice: in single process mode, we only start one agent worker and one app worker

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendRandom(action, data) → {Messenger}

send message to one app worker by random

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process Notice: in single process mode, it only can send to self process, and it will send to both agent and app's messengers.

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

Messenger

new Messenger()

Source:

Methods

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

sendRandom(action, data) → {Messenger}

send message to one worker by random Notice: in single process mode, we only start one agent worker and one app worker

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendRandom(action, data) → {Messenger}

send message to one app worker by random

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process Notice: in single process mode, it only can send to self process, and it will send to both agent and app's messengers.

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

Messenger

Communication between app worker and agent worker by IPC channel

Constructor

new Messenger()

Source:

Methods

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

broadcast(action, data) → {Messenger}

Send message to all agent and app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

send(action, data, to) → {Messenger}

Parameters:
Name Type Description
action String

message key

data Object

message value

to String

let master know how to send message

Source:

sendRandom(action, data) → {Messenger}

send message to one worker by random Notice: in single process mode, we only start one agent worker and one app worker

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendRandom(action, data) → {Messenger}

send message to one app worker by random

  • if it's running in agent, it will send to one of app workers
  • if it's running in app, it will send to agent
Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendTo(pid, action, data) → {Messenger}

send message to the specified process Notice: in single process mode, it only can send to self process, and it will send to both agent and app's messengers.

Parameters:
Name Type Description
pid String

the process id of the receiver

action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToAgent(action, data) → {Messenger}

send message to agent

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source:

sendToApp(action, data) → {Messenger}

send message to app

Parameters:
Name Type Description
action String

message key

data Object

message value

Source: