Reputation: 327
I know the electron ipc module allows one main process to communicate with multiple render process. On top of this, is there a way to use another main process to communicate with multiple main processes simultaneously?
Upvotes: 5
Views: 3479
Reputation: 2208
This may help -- https://itnext.io/multi-threading-and-multi-process-in-node-js-ffa5bb5cde98
I use child_process.fork()
https://github.com/rep2recall/rep2recall/blob/1873d17e281f934b0224751a9c29a518324fb9ad/packages/e-app/app.js#L2
Upvotes: 0
Reputation: 5714
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 communication 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 communication library/method? provides some possible answers. One of the answers points to the node-ipc project on GitHub: https://github.com/RIAEvangelist/node-ipc. This particular solution appears to use sockets to pass the messages.
Upvotes: 6