Thanks to visit codestin.com
Credit goes to github.com

Skip to content

重构 messenger #28

@dead-horse

Description

@dead-horse

提供方法:

  1. broadcast(action, data):发送给所有的 agent / app 进程(包括自己)
  2. sendToApp(action, data): 发送给所有的 app 进程
    • 在 app 调用该方法上会发送给自己和其他的 app 进程
    • 在 agent 上调用该方法会发送给所有的 app 进程
  3. sendToAgent(action, data): 发送给 agent 进程
    • 在 app 调用该方法上会发送 agent 进程
    • 在 agent 上调用该方法会发送给 agent 自己
  4. sendRandom(action, data):
    • app 上没有该方法(现在 egg 的实现是等同于 sentToAgent)
    • agent 上回随机发送消息给一个 app 进程(由 master 来控制发送给谁)
  5. sendTo(pid, action, data): 发送给指定进程

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions