Can a node run in-browser or must it run on nodejs?

Is there a way to instruct a node in a flow, or indeed the entire flow, to run in the browser as opposed to on the server side node-js?

I'm thinking of situations where proprietary on-site data must not leave the premises, but they still want the node-red environment to come from an external server.

Node-red runs in the device it is installed on.

So that's not strictly true, because I can run it on my raspberry pi, and access it from another computer, so in that scenario we have two separate computers involved, one serving the interface and running node code (server), and the other displaying the interface and allowing for interaction (client). So node red is running on both computers, just each is specialised at one thing or another. So what I'm asking is, can I run some of the nodes' actual code not on the server, but on the client, that is, in the browser. This should not be difficult theoretically, because the node.js runtime, and the browser's javascript engine, are essentially identical. But this capability would have to be exposed and that's what I'm wondering.

What @zenofmud said is 100% true however that doesn't mean you cant provide some means of sending a payload to a browser, perform some computation then return the result to node-red.

nodejs and the browser do run in the same runtime but the functionality nodejs provides is NOT available in the browser. Do a search for "run node js in browser"

For example, this solution I provided another user creates a web page where an image is processed client side and passed back to node-red.

The bottom line is, the core of node-red runs in nodejs on top of the v8 engine.

1 Like

yeah okay so I build my own IPC / RPC mechanism. Fair enough.

Well for example some of the Ui nodes process data in the browser then pass back the result only, so yes specific nodes could. But node to node comma is via the backend

1 Like

do you have an example of such a node?

well most of the ui nodes do some processing at the client end even if it's just to format up the message - but I guess maybe look at some of the extra nodes here - Node-RED Dashboard extra nodes (collection) - Node-RED
maybe the ui-microphone one as that has a Speech to text option that does the reco in the browser and then sends the the text.

1 Like

You could also run local instances of Node-RED assuming the local device was capable. There are various ways to link instances of Node-RED together.

1 Like

So thank you @TotallyInformation @dceejay @Steve-Mcl @zenofmud for the great feedback and information. This sure is a nice helpful community. I'm going to experiment now and hopefully have a lot of fun!

2 Likes

Good luck. Interested to see what you come up with.

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