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?
You actually can communicate between 2 Electron windows via JS if you open the popup window from the renderer process of the main window, by using window. open(). This avoids the need to communicate via IPC calls.
IPC channels In Electron, processes communicate by passing messages through developer-defined "channels" with the ipcMain and ipcRenderer modules. These channels are arbitrary (you can name them anything you want) and bidirectional (you can use the same channel name for both modules).
The ipcMain module is an Event Emitter. When used in the main process, it handles asynchronous and synchronous messages sent from a renderer process (web page). Messages sent from a renderer will be emitted to this module. For usage examples, check out the IPC tutorial.
Electron node integration refers to the ability of accessing Node. js resources from within the “renderer” thread (the UI). It is enabled by default in Quasar CLI, although Electron is encouraging developers to turn it off as a security precaution.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With