Node-RED Flows as WebAssembly (WASM) Modules

I’ve been exploring Node-RED recently, and I’m curious: can Node-RED flows be executed as WebAssembly (WASM) modules? I’ve searched around, but I couldn’t find any direct references or documentation on this topic. If anyone has insights or pointers, I’d greatly appreciate it!

You can generate a wasm module from (based on) your node-RED flow json to run the flows as WebAssembly in your browser with the tools provided in this experiment: GitHub - kazuhitoyokoi/node-red-wasm

Or just in case this is more what you meant; you can load and run wasm modules in your node-RED flows with this node: node-red-wasmer (node) - Node-RED
Writeup: WebAssembly in NodeRED | Jack Carey

I’m curious about webassembly myself, but I guess my flow or function node would have to be intensely computation heavy to justify compiling, loading and executing a wasm module in its place (per March 2024). I’m not sure whether it helps with the JavaScript V8 thread issue either. At least that would explain the missing interest around the aforementioned projects.

A future in which locking a flow tab in Node-RED would compile it into a wasm module and run that part of the flows as such instead, would be cool though. Or as an option for subflow instances. And in that case, instead of explaining all possible of the 4500+ community nodes in webassembly in case of locking and compiling, AssemblyScript may be a viable bridge as it’s pretty close to typescript and can actually use the same transpiler to javascript, as well as providing a compiler to wasm (https://www.assemblyscript.org).

1 Like