I want to run node red on my pc and have it communicate / control a resident PC application (the application will be a C# console or Windows application used to control an external piece of hardware through automotive LIN).
I wondered what is the best way that I can get Node Red to talk to an application sitting on the same PC machine? Should I write the PC application like a dll or command line interface (CLI)?
You could potentially write the app inside a node.js wrapper which could be a node-red node. That would be one way.
Alternatively, it is going to depend on whether you intend the app to remain resident in-memory. If it is, then a simple TCP or UDP connection would do the job as long as inter-process security isn't an issue.
That was the impression I got from the op (single pc, resident application).
I recently did a similar job where I needed to communicate node-red to a .net application. I looked into bindings, TCP/UDP, remoting, soap/rest, file & a bunch of other technologies. In the end, (local) MQTT was a no-brainer.
@mikeyd0407 can I ask, what will this application do that node-red cannot? I mean, if you are going to the effort of writing a Windows application, could you not simply use node-red - or are you automating some other proprietary application?
Hi Steve, and thank you all for your suggestions. The end application is to use an automotive LIN interface. I want node red to act as a simple to configure and adjust UI. The LIN interface I have (PLIN-USB: PEAK-System ) comes with a .net API. My understanding is that this interface API is not compatible with Node Red, so I was thinking of making a simple boiler plate c# application that I can use as an intermediary. So if this is the correct way of doing this, then it would be how to connect my LIN application to Node Red
There are other ways for example Edge JS. But what you're proposing is very doable and not too difficult
As I mentioned in my previous post I would (did) go with mqtt.
The benefit you gain using mqtt is you can have other applications connected to the broker to provide secondary monitoring / control. Also all of the hard work of maintaining/restoring connections is taken care of by the protocol. (I.e. you don't have to start programming sockets)
Don't worry too much if you don't know a lot about mqtt, it is extremely simple to get your head around. Far easier than a rest API or raw sockets.
If you really wanted to do it as a full Node-RED integration, you could simply use the .net part as library wrapped with a Node-RED node since Node.js supports this too I think (same as wrapping a C/C++ library with node.js?)