New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
重构 messenger #28
Comments
可以分开写下,比如 app 应该没有 sendRandom 方法。 app 调用 sendToApp 会怎么样,sendToAgent 同理 sendTo 可以增强一下,如果是 number 是 pid,都要可以指定 target,比如 app master parent,作为上面方法的基础 |
更新了一下。 sendTo 方法的增强是指可以 |
前一种,process 传的时候有个 to 参数 |
我们需要让应用或者插件开发者感知到 master 和 parent 么?感觉我们现在的这些插件也没出现过向 master 和 parent 发消息的需求啊 |
更通用一些,send pid 用的也很少 |
这样?
但是 master 和 parent 上其实没有对应的 messenger 实例,应该没法保持这个 action + data 的模型吧?只能 send 一个大的 object 过去? |
master 有的,parent 只有 process |
sendTo('app/agent/master/parent') |
parent 是我们不能控制的,mater 其实开发者也无法编写任何逻辑,感觉在暴露给用户的 API 上面增加发给他们的方法只会让使用者更疑惑? |
这个还会暴露给插件开发者和核心开发者,比如测试等可能会用到 |
那 sendTo 当做一个内部函数来实现好了?反正应用层不会需要这个方法? |
app 进程
agent 进程
重新整理下 API @dead-horse |
@popomore worker 没启动时, agent 发消息, 这个顺便 warning 下 |
这个不是有另外一个 issue 么 |
|
- broadcast is changed, it will send to all process - send is changed, it won't emit message Closes #28
- broadcast is changed, it will send to all process - send is changed, it won't emit message Closes #28
- broadcast is changed, it will send to all process - send is changed, it won't emit message Closes #28
- broadcast is changed, it will send to all process - send is changed, it won't emit message Closes #28
提供方法:
broadcast(action, data)
:发送给所有的 agent / app 进程(包括自己)sendToApp(action, data)
: 发送给所有的 app 进程sendToAgent(action, data)
: 发送给 agent 进程sendRandom(action, data)
:sendTo(pid, action, data)
: 发送给指定进程The text was updated successfully, but these errors were encountered: