I think your choice of IPC method will depend on what data you need to share between windows and how you manage windows. For example, if you manage your windows from the main process, you can use the Main process as a central hub for sending messages using the Electron 'ipc' modules. If your windows know about each other, it might be better to exchange messages directly between them without going through the main process.
If you open one window from another using Electron window.open
, you can then use postMessage
in the window's proxy (in the child window, use window.opener.postMessage
) to send messages.
Of course, you can also open a socket between two windows or use any other form of IPC, especially if you need to transfer a lot of data. For simple messages and events, postMessage
should be fine, though.
source share