Live-updating nodes

I'd love to do the following without restarting Node-RED server:

  1. Adding new nodes
  2. Removing nodes
  3. Updating a node's behaviours and appearances

I want user to simply reload the Node-RED page in the web browser to have all these up to date.

#3 seems doable:
With JS, I imagine dynamic behaviours can be achieved through some dependency injection tricks, but not sure if I can change certain things such as a node's name, colour, or its editor layout without restarting node-red.

But I'm not sure how to make #1 and #2 happen.

Are there any standard facilities or best practice regarding this with Node-RED?

For example, this make little sense by itself. I mean what is it you expect? For contrib nodes to be automatically updated because the user refreshed their browser? How do you expect the runtime (where nodes run - server side) to be instructed that an update is needed?
I am certain you know what you want/need but it isnt 100% clear to me.

Already possible via palette manager and API

Already possible via palette manager and API however a restart of the runtime is required to fully unload the module from memory.

Your own node? Other or CORE nodes? What do you mean?

NOTE: As you posted in #creating-nodes - I have assumed you are creating a contrib node-red node?

@Steve-Mcl I was talking about my own custom nodes exclusively.
Those nodes are used internally and will not be published.
Sorry for the confusion.

Thanks for the tip about the palette. I'll take a look.

In which case it sounds like you need to provide your internal node-red servers with an internal custom catalog so that your private nodes can be presented to the private node-red servers

Here is such an example using another node-red to host the catalog: Serving my own catalog via Node-RED - #11 by shrickus

1 Like

Hah, in fact I was using the same node-red instance to limit itself... I just love how customizable node-red is!

1 Like

I too have a question about restarting or “reloading” Node-RED; possible from the API?

Use case:
I have a node that syncs functions and templates for use with an external editor; in the latter part it alters the flow file and currently instructs users to “restart node red to see changes take effect”.

Another use case with hack:
I created a project for creating nodes and when alterations are made refreshing the browser is trivial; but restarting Node-RED is essential to pickup changes to node_modules. This is probably too low-level as it’s more than just altering nodes and deploying. To accomplish this, it uses an exec. shell to re-start Node-RED but this requires that it knows where Node-RED is and is aware of the prior PID. It’s complicated and not FlowForge compatible but its target is lower level Node devs anyways.

Perhaps just for flow2src, is there anyway to invoke reloading a project’s flow file from the API?

Perhaps just for flow2src, is there anyway to invoke reloading a project’s flow file from the API?

See the reload action available on POST /flows : Node-RED

1 Like

It isn't clear to me from the docs what one provides in the request body for the reload action.

An empty body is sufficient

Great, thanks.

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