I'm trying to use a module I made myself in the main process in Electron,but for some reason it doesn't work as intended (at all).
In the main process (main.js), I define the module
const connection = require('connection');
That module exports a function called init
var Connection = { init: function() { ... }, ....}module.exports = Connection;
But when trying to call this method, through the main process (main.js) on a webpage. (login.html)
var Connection = require('electron').remote.connection;Connection.init();
It tells me that Connection is undefined.I know the Connection module I made works, because I've used it just fine in the renderer process.
The reason that I want to use the entire Connection module in the main process, is so that I could keep that connection alive and performing tasks even when the user goes to another page.
I've searched all around but can't seem to find the solution to my problem.
Thank you.