Creating a Custom Node on the basis of another Node as Dependency

Hi,

i am currently trying to create a custom node. In this custom node i need an instance from node-red-contrib-opcua. Especially from the server node there because i need the server object.

So i tried to "require" the whole server.js as a module inside my custom node. But this doesnt work because the module will try to register the server node which is already there.

Is there a better workaround for this? I need for example the initNewServer() function in this node. But it seemed to be encapsulated. Structure is:

module.exports = function (RED) {
...
OpcUaServerNode(n){
...
initNewServer(){

I am still a newbie with node.js and Node-RED so i don't know if there is a common solution for this. I know that i could create the server node from the "node-opcua" dependency myself, but it would be more logical for me to include the node-red-contrib-opcua as a Dependency because i work with more nodes from there inside my flows.

Thanks a lot

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.