admin管理员组

文章数量:1415460

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

本文标签: javascriptIs there a way to communicate between multiple electron main processesStack Overflow