Node-RED communications protocols

Published: | Updated: | by Julian Knight Reading time ~1 min.
📖 Kb | 📎 Development | 🔖 Node-RED, Communications, Protocols, MQTT, Websockets, TCP, UDP

Node-RED has an excellent choice of communications protocols available to it. This article looks at the main options and their strengths and weaknesses. It also gives suggestions as to when you may wish to use them.

Node-RED is renown for its MQTT support since that is where it started - as an IBM demonstrator for their experteese on IoT.

However, this is only one of many ways to send/receive data between Node-RED and other systems or services. Each of tese protocols has its own advantages and disadvantages.

The protocols 🔗︎

In rough order of descending order of ease of use (very rough!):

  • MQTT
  • Websocket
  • HTTP
  • TCP
  • UDP
  • UNIX Pipes

MQTT 🔗︎

This is likely to be the easiest to use even though it requires an extra service to be running, a “Broker”.

There is even a custom node available that lets you run a broker from within Node-RED itself. However, I don’t recommend doing that because it adds significant overheads that are easily avoided. The most commonly used broker is “Mosquito” which has low resource overheads, is fast, secure and capable. It is easily installed and configured.

While MQTT data payloads are just strings, Node-RED lets you send and receive more complex data structures (JSON).

The things that put MQTT at the top of the list are:

  • The ability to easily handle more complex data
  • The availability of MQTT libraries and clients for many platforms

Websocket 🔗︎

HTTP 🔗︎

TCP 🔗︎

UDP 🔗︎

UNIX Pipes 🔗︎


comments powered by Disqus