Practical Node-RED Programming
eBook - ePub

Practical Node-RED Programming

Learn powerful visual programming techniques and best practices for the web and IoT

Taiji Hagino

Compartir libro
  1. 326 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Practical Node-RED Programming

Learn powerful visual programming techniques and best practices for the web and IoT

Taiji Hagino

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Use a low-code programming approach to create event-driven applications from scratch by wiring together hardware devices, APIs, and online services

Key Features

  • Discover how you can automate the Internet of Things (IoT) without writing huge blocks of code
  • Learn how to wire together flows using a browser-based visual editor
  • Handle IoT data with little to no coding knowledge

Book Description

Node-RED is a free and open source flow-based programming tool used to handle IoT data that allows programmers of any level to interconnect physical I/O, cloud-based systems, databases, and APIs to build web applications without code.

Practical Node-RED Programming is a comprehensive introduction for anyone looking to get up to speed with the Node-RED ecosystem in no time. Complete with hands-on tutorials, projects, and self-assessment questions, this easy-to-follow guide will help you to become well versed in the foundations of Node-RED. You'll learn how to use Node-RED to handle IoT data and build web applications without having to write complex code. Once you've covered the basics, you'll explore various visual programming techniques and find out how to make sample flows as you cover web development, IoT development, and cloud service connections, and finally build useful real-world applications.

By the end of this book, you'll have learned how to use Node-RED to develop a real-world application from scratch, which can then be implemented in your business.

What you will learn

  • Understand the history of Node-RED and why you need to learn a flow-based programming tool
  • Use Node-RED to build Node.js-based applications
  • Handle data for IoT devices using Node-RED flows
  • Explore advanced Node-RED features such as connecting repositories and customizing the flow editor
  • Find out what the MQTT protocol is and how it relates to Node-RED
  • Create and publish your own nodes and flows using the Node-RED library

Who this book is for

This Node-RED book is for web developers and IoT engineers with some background in JavaScript and Node.js. Although not necessary, familiarity with the concepts of electronics will help you to make the most out of this book.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Practical Node-RED Programming un PDF/ePUB en línea?
Sí, puedes acceder a Practical Node-RED Programming de Taiji Hagino en formato PDF o ePUB, así como a otros libros populares de Computer Science y Computer Networking. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2021
ISBN
9781800207660
Edición
1

Section 1: Node-RED Basics

In this section, readers will understand what a flow-based programming (FBP) tool is, including Node-RED, along with how to undertake IoT/web programming with it, and will learn how to use the Node-RED flow editor at a basic level.
In this section, we will cover the following chapters:
  • Chapter 1, Introducing Node-RED and Flow-Based Programming
  • Chapter 2, Setting Up the Development Environment
  • Chapter 3, Understanding Node-RED Characteristics by Creating Basic Flows
  • Chapter 4, Learning the Major Nodes

Chapter 1: Introducing Node-RED and Flow-Based Programming

This chapter will help you grow from being a reader to being a Node-RED user. First, you'll learn about the history of Flow-based programming (FBP) tools, not just Node-RED. You will then gain a broad understanding of the entirety of Node-RED as a useful tool for building web applications and the Internet of Things (IoT) data handling, before learning what IoT and Node.js are in terms of Node-RED.
Providing technical content will help accelerate your software application development, but if you take a look at the history of the Node-RED tool itself, it will help you better understand why you need a FBP tool such as Node-RED. That is what we will be doing in this chapter.
More specifically, we'll be covering the following topics:
  • What is FBP?
  • What is Node-RED?
  • Node-RED benefits
  • Node-RED and IoT
Let's get started!

What is FBP?

So, what is FBP in the first place? It's the workflows you use in your work that you can easily imagine. Let's recall those workflows.

Workflows

In a normal workflow, boxes and wires indicate the process flow. It may be just one business design. Boxes represent processes. Box processing is defined by who, when, where, what, and how much. Sometimes, it's like explicitly writing out the flow of processing, such as by using swim lanes or placing writing definitions inside boxes. In any case, looking at the box should reveal what will be done.
On the other hand, let's try to summarize this business process as a document. Don't you think it will be complicated? Who will do what as they read it, even if they use some paragraphs well to put it together? When will you do it? It could be confusing:
Figure 1.1 – Workflow example
Figure 1.1 – Workflow example
Now, let's get back to software programming. FBP is a kind of concept for software programming that defines an application with a data flow. Each part of the process is there as a black box. They communicate data between connected black boxes that have been predefined. FBP is said to be component-oriented because these black-box processes can be connected repeatedly to form several applications without needing to be modified internally. Let's explore FBP in more detail.

Flow-based programming (FBP)

I think FBP is a good blend of workflow and dataflow. FBP uses a data factory metaphor to define an application. It sees an application as a network of asynchronous processes that start at some point and do a single sequential process that does one operation at a time until it ends, rather than communicating by using a stream of structured chunks of data. This is called an information packet (IP). This view focuses on the data and its transformation process to produce the output that is needed. Networks are usually defined outside a process as a list of connections that is interpreted by a piece of software called a scheduler.
Processes communicate via fixed capacity connections. Connections are connected to processes using ports. The port has a specific name that is agreed on by the network definition and the process code. At this point, it is possible to execute the same code by using multiple processes. A particular IP is usually only owned by a single process or transferred between two processes. The port can be either a normal type or an array type.
FBP applications typically run faster than traditional programs, since FBP processes can continue to run as long as there is room to put in data and output to process. It does not require any special programming and makes optimal use of all the processors on the machine.
FBP has a high-level, functional style so that the behavior of the system can be easily defined; for example, in a distributed multi-party protocol such as a distributed data flow model, for accurately analyzing the criteria for determining whether a variable or statement behaves correctly:
Figure 1.2 – Simple FBP design example
Figure 1.2 – Simple FBP design example
Now that you have a solid understanding of FBP, let's learn how Node-RED can be implemented in this way.

What is Node-RED?

Node-RED is one of the FBP tools that we have described so far. Developed by IBM's Emerging Technology Services team, Node-RED is now under the OpenJS Foundation.

Overview

FBP was invented by J. Paul Morrison in the 1970s. As we mentioned earlier, FBP describes the behavior of the application as a black box network, which in Node-RED is described as a "node." Processing is defined in each node; data is given to it, processing is performed using that data, and that data is passed to the next node. The network plays the role of allowing data to flow between the nodes.
This kind of programming method is very easy to use to make a model visually and makes it easy to access for several layer users. Anybody can understand what the flow is doing if a problem is broken down into each step. That's why you don't need to the code inside the nodes:
Figure 1.3 – Node-RED Flow Editor as an FBP tool
Figure 1.3 – Node-RED Flow Editor as an FBP tool

Flow editor and runtime

Node-RED is not only a programming tool but also an execution platform that wraps up the Node.js runtime for applications that are built using Node-RED.
We need to use the flow editor to make Node-RED applications for IoT, web services, and more. The flow editor is also a Node.js web application. We will ...

Índice