Node-RED is a flow
engine with IoT focus, which allows to graphically define service flows, through standard protocols like REST, MQTT, Websocket, AMQP… as well as providing integration with third party apis, like Twitter, Facebook, Yahoo!…
It is a very light visual tool, programmed in NodeJS and can run from either devices as limited as a Raspberry, or even on complex platforms such as IBM Bluemix, Azure IoT or Sofia2 Platform.
The flow editor of Node-RED consists of a simple HTML interface, accessible from any browser, in which it is possible to define a flow that offers a service by visually dragging and connecting nodes with each other.
The editor is structured as a simple graphical environment with:
- Palette of Nodes: shows all the nodes that we have available in our installation. As we will see later, there is a repository of nodes developed by other users and we can even create and install our own nodes.
- Editor: allows us to drag nodes from the palette and connect them. In this way we will create operation’s flow.
By selecting each node we can see, on the right side, its configuration form, where it is possible to establish the node properties:
Node-RED is an open source tool, it is available in github (https://github.com/node-red/node-red). One of the most remarkable features of Node-RED is the simplicity with which new nodes can be created and installed. On the following link it is available the required documentation: http://nodered.org/docs/creating-nodes/, we can see that developing a new node is as simple as creating an HTML file with the configuration form shown in the previous image, and a JS file with the node logic written in NodeJS.
In this way, any person or organization can create their own nodes adapting the flow engine to the needs of its business.
Flows programmed in Node-RED are stored internally in JSON format and are portable between different installations of Node-RED as long as the the nodes used in the flow are available in the destination Node-RED.
A Node-RED flow consists of a file such as the following:
The ease of development of new nodes, as well as the portability of flows, provide a marked social focus on Node-RED. Much of its success is based on the fact that nodes and flows developed by one person or organization can be used by others. On the official site of Node-RED we can find a section of third-party contributions, with more than 1000 nodes and flows uploaded by the community and ready to use:
Including a node for Sofia2 developed by our Indra Italia team (thanks Alberto)
There are two alternatives to install Node-RED:
- Standalone Mode: where it is executed as a process NodeJS independent of the rest of processes.
- Imbedded Mode: where it is part of a bigger application, it is responsible to control the life cycle of the Node-RED.
The security of both of them could be an access control with user and password or with a SSL certificate to access to the editor by HTTPS protocol.
It also has an API Rest for administration and operation (http://nodered.org/docs/api/) so that it can interact and be controlled by an external system.
These characteristics are what make Node-RED suitable for running on any platform, because it can be installed in both type of systems, a Raspberry and a bigger system like IBM Bluemix.
In the next release of Sofia2 Platform, Node-RED is going to be included as a flow editor, provided with a set of nodes that allow to interact with different services of the platform.
In the next days we will publish a series of videos, showing how simple it is to define flows that interact with Sofia2 Platform.