Sending IPC events from a different main script


Electron appealed to me and my clients for the simplicity of deploying applications to and fro, so I started out with it. As such I came across this interesting quarrel.

Considering I’m used to writing client/server networks with fully isolated server code; I write all the application logic in separate files. for Electron this implies leaving the main.js file alone and writing the logic in, shall we say, app_main.js

When implementing IPC, I have been able to send messages from the renderer to app_main, but I seem to be unable to send messages from app_main to the renderer directly, maybe because i’m used to and thinking IPC would act the same.

My question is a simple one, How would I be able to immediately send messages from app_main to renderer.js in this case?

What I’ve found was to either use the “remote” component or “mainWIndow.webcontents” but either seem to fail despite being “required” in the app_main file. Perhaps I’m overlooking something?