-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Welcome to electron-ipc-bus, a safe IPC bus for Electron !
Electron is an open-source framework, developped by GitHub, that bundles a Node.js engine
and a Chromium web browser. By the way, with Electron you can built Desktop applications
with JavaScript and HTML.
Electron follows the process model used by Chromium, this means that an application
built on Electron will run many specialized processes instead of a single all-in-one process.
-
Main process (singleton)
The Main process is responsible for UI, I/O and with Electron, it is also a Node instance
that runs the application's main program. The Electron's API is available. -
Renderer processes
Renderer processes are responsible to handle rendering and JavaScript execution related
to a web page. In Electron, a renderer process is created each time a BrowserWindow
triggers a navigation. The Electron's API is available. -
Node instances
Node instances run a specific JavaScript file like a standard Node.js process.
In this mode, Electron's API is NOT available.
This multi-process architecture makes IPC absolutely required to be able to synchronize
components and exchange data. Hopefully, Electron provides an quite simple IPC mechanism
that allows the Main process to communicate with the Renderer processes and Node.js
provides a mechanism that allows the Main process to communicate with the Node instances.
Basically, we have all technical stuff to do IPC between all the processes but ...
- There are two different mechanims (one for Renderer processes and another for Node instances)
- The Main process is the only process that can communicate with all others processes
- These mechanims are used by Electron itself to handle internal workflows
As a consequence, doing IPC between a Renderer process and a Node instance is quite
complicated. Moreover, a malicious code running in a Renderer process can intercept
messages used internally by Electron and compromise the whole application.
The electron-ipc-bus is designed to offer the following benefits :
- One single mechanism to communicate with any process
- The bus is dedicated to the application. Any other IPC mechanim is hidden
- Works with sandboxed Renderer processes