Connect 2 node-red with tcp

Hello, how I can send the data that I receive in the first node-red to the second with this tcp configuration?

Is there any solid reason why you wish to use TCP?

If it is just to send values back and forth, MQTT might be a better solution (no need to handle disconnections etc)

It is very easy to get going with MQTT.

This would help get you started (if you need a leg up)...

1 Like

Agree, why make it difficult?

I have one pi that runs mosquito + NodeRED. On this PI all the compute and data handeling is done. The computed data is then posted back to the broker. For example, my smart meter data is processed on this PI, the messages are formatted correctly, and electricity cost is calculated. The calculated are sent back to the broker.

Several touchscreens around the house run a NodeRED dashboard That uses the compute data through the broker. For the smart meter data it just uses the outcome of the calculations posted from the PI described above.

Short answer to OP question is not to use TCP port 1880 as that is the port used for the web interface so you can use an http node to connect to that, or use a different TCP port.

I use TCP to achieve the data transmition between two diferent node-red, the part where I receive the data from my gateway is ok for me, but as I say my intention is to reply it to another node-red.
I need it because I need to create a OPC UA server and save the data in a file, and in my gateway node-red app i'm not able to install the OPC and other libraries.

I reply the same as Steve (I don't know how to reply both at same time):

I use TCP to achieve the data transmition between two diferent node-red, the part where I receive the data from my gateway is ok for me, but as I say my intention is to reply it to another node-red.
I need it because I need to create a OPC UA server and save the data in a file, and in my gateway node-red app i'm not able to install the OPC and other libraries.

Perfect, I'm going to try it, tnak you.

And as I said, you could use MQTT - it would save you the hassle of managing connections / disconnections, formatting your data, looking for end markers, etc etc etc. MQTT is IDEAL for situations like this.

By using MQTT you also gain other "features" (for example you can watch/examine the data from a separate MQTT client / dashboard / web page)

Let me put it this way (then I will leave you to do it the DIY way)...

  • MQTT is a protocol that runs over TCP that permits you to easily transmit DATA between 2 or more devices, designed by far greater minds than ours.
  • RAW TCP is DIY and you will face challenges that the MQTT developers have already thought out and solved.

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