@cinhcet, @dceejay,
Thanks but I thought using (node/flow/global) contexts wouldn't be a good solution in this case. Suppose I would do it like this:
var mitm = new Mitm();
this.context().global.set(mitm);
Inside that constructor the whole interception stuff is being setup. So what happens if a Node-RED contextstore is storing and loading that instance? Therefore I thought it would be better to avoid using the context???
@TotallyInformation: Suppose I do it like this:
module.exports = function(RED) {
var Mitm = require("mitm");
var mitm = new Mitm();
function HttpLoggerNode(config) {
RED.nodes.createNode(this, config);
}
RED.nodes.registerType("http-logger",HttpLoggerNode);
}
Do you mean that the "mitm" variable is only initialized once (i.e. constructor is only executed once), and available to all the HttpLoggerNode's in my flow?