Comments (15)
可以分开写下,比如 app 应该没有 sendRandom 方法。
app 调用 sendToApp 会怎么样,sendToAgent 同理
sendTo 可以增强一下,如果是 number 是 pid,都要可以指定 target,比如 app master parent,作为上面方法的基础
from egg.
更新了一下。
sendTo 方法的增强是指可以 sendTo('app', action, data)
还是说在指定 pid 的同事还可以加一个 target 的条件(必须满足 pid 相等,target 相同)?
from egg.
前一种,process 传的时候有个 to 参数
from egg.
我们需要让应用或者插件开发者感知到 master 和 parent 么?感觉我们现在的这些插件也没出现过向 master 和 parent 发消息的需求啊
from egg.
更通用一些,send pid 用的也很少
from egg.
这样?
sendTo('parent/master', action, data)
sendTo(pid, action, data)
但是 master 和 parent 上其实没有对应的 messenger 实例,应该没法保持这个 action + data 的模型吧?只能 send 一个大的 object 过去?
from egg.
master 有的,parent 只有 process
from egg.
sendTo('app/agent/master/parent')
from egg.
parent 是我们不能控制的,mater 其实开发者也无法编写任何逻辑,感觉在暴露给用户的 API 上面增加发给他们的方法只会让使用者更疑惑?
from egg.
这个还会暴露给插件开发者和核心开发者,比如测试等可能会用到
from egg.
那 sendTo 当做一个内部函数来实现好了?反正应用层不会需要这个方法?
from egg.
app 进程
- broadcast(action, data) 发送给 agent 和所有 app(包括自己)
- sendToApp(action, data) 发送给所有 app(包括自己)
- sendToAgent(action, data) 发送给 agent
- sendTo(pid, action, data) 指定 pid 发送
agent 进程
- broadcast(action, data) 发送给自己和所有 app
- sendToApp(action, data) 发送给所有 app
- sendToAgent(action, data) 发送给自己
- sendRandom(action, data) 随机发送给一个 app
- sendTo(pid, action, data) 指定 pid 发送
重新整理下 API @dead-horse
from egg.
@popomore worker 没启动时, agent 发消息, 这个顺便 warning 下
from egg.
这个不是有另外一个 issue 么
from egg.
让 master 告诉子进程 pid,然后都 sendTo pid 是不是更好。 暂时不破坏 master 模型了。
from egg.
Related Issues (20)
- extend/application.js空导出,导致接口返回404 HOT 1
- 文档链接显示错误
- 依照官网初始化项目 HOT 1
- eggjs处理服务端请求有超时时间吗 HOT 3
- 在 service 中 extends egg 暴露的 Service 项目无法启动 HOT 1
- egg-router-plus 根 router 应该支持正则 HOT 1
- 能否将依赖的urllib升级为3.25的系列,而不是现在的2.41.0 HOT 2
- 怎么在没有app上下文的文件中 获取config中的配置? HOT 4
- 使用 oxlint 代替 eslint HOT 5
- egg 运行一段时间后,就会退出 HOT 1
- Track Progress of PR #5332 Towards Merging into Master
- Follow-up on PR #5334: Allow to create httpClient from app
- Track merging PR #5336 into master branch
- 服务器 egg-scrips start 无法启动,一直提示文件找不到。但是本地能正常运行 HOT 5
- Track merging of PR #5339 into master
- Track bugfix for httpclient.safeCurl typing
- eggjs返回的响应头为什么是使用小写? HOT 4
- 初始化项目跑不起来 HOT 1
- 为什么在服务启动命令中添加参数在服务生命周期中获取不到? HOT 2
- enableH2 开启的时候使用 undici v6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egg.