Does n8n currently offer any sort of global object store besides using
global? I’m creating nodes for Discord and I have a very good looking proof of concept; I just would like the ability to store the discord.js client object to be shared among nodes which share the same credentials. For instance, I need to trigger upon new messages and emoji reactions, which works. However, each trigger node makes its own separate client. With a few different workflows I’ve been messing with, this would create around 10 clients connected to Discord at the same time, which isn’t ideal.
If there were a way to store a client object into an instance of a credential, this would be a bit easier and feel safer than using plain old
global. When a node uses a credential, it could call a “create client” method to create a shared client object used among all nodes which use that credential. It would then make that client object available to the node methods like
execute, etc. It could also call a destroy method whenever there are no more nodes using the credential.
I’m looking forward to publishing my new Discord nodes, as they’ve been quite useful to me, even during the development stages.