最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is there a way to communicate between multiple electron main processes? - Stack Overflow

programmeradmin1浏览0评论

I know the electron ipc module allows one main process to municate with multiple render process. On top of this, is there a way to use another main process to municate with multiple main processes simultaneously?

I know the electron ipc module allows one main process to municate with multiple render process. On top of this, is there a way to use another main process to municate with multiple main processes simultaneously?

Share Improve this question asked Mar 27, 2016 at 2:49 user3669481user3669481 3277 silver badges19 bronze badges 2
  • What do you mean by "multiple main processes"? Multiple Electron apps? – Max Commented Mar 27, 2016 at 13:00
  • yes multiple electron apps – user3669481 Commented Mar 28, 2016 at 3:36
Add a ment  | 

3 Answers 3

Reset to default 6

As far as I know there is no built-in facility for doing this in Electron. That being said, the answer to your question is the same as the answer to the broader question of how to do inter process munication in Node.js, to which there are multiple answers. You can use sockets directly, file passing, databases, messaging systems, Redis, etc...

This question: What's the most efficient node.js inter-process munication library/method? provides some possible answers. One of the answers points to the node-ipc project on GitHub: https://github./RIAEvangelist/node-ipc. This particular solution appears to use sockets to pass the messages.

This may help -- https://itnext.io/multi-threading-and-multi-process-in-node-js-ffa5bb5cde98

I use child_process.fork() https://github./rep2recall/rep2recall/blob/1873d17e281f934b0224751a9c29a518324fb9ad/packages/e-app/app.js#L2

child_process.spawn will work for this particular problem

发布评论

评论列表(0)

  1. 暂无评论