BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News IBM's Nick O'Leary Demos Node-RED for the Internet of Things

IBM's Nick O'Leary Demos Node-RED for the Internet of Things

This item in japanese

Nick O'Leary presented Node-RED, an open-source project focused on the Internet of Things (IoT), at the last QCon London. The project, created by IBM's Emerging Technology team, provides a browser-based environment for visually "wiring together hardware devices, APIs and online services in new and interesting ways". Node-RED is capable of running on low cost hardware such as the Raspberry Pi and in the cloud and aims to enable developers to "focus on the task at hand and not worry about the plumbing".

After presenting several example use cases of IoT, Nick demonstrated Node-RED's ease of use and versatility by simply using his web browser to create a small message flow that consumed tweets with hash tag #qconlondon, performed a sentiment analysis and simultaneously output the positive ones to a LED panel in front of his speaker desk via a serial port and to the presentation in his browser via WebSockets.

Node-RED WS-Tweet Demo at QCon London 2014

Nick stressed that his examples don't just show how to solve a specific problem, but also highlight the enabling quality of open data and APIs. However, he continued, the diversity of devices and platforms makes that difficult for any individual, because "half of it won't interoperate, everyone has their own API, there are lots of different protocols out there, […] it's a glorious mess". As a result, developers need to "spend more time on the plumbing of a solution than what [they] are trying to achieve".

Node-RED's goal is to change that by providing a browser-based editor, which allows connecting a wide range of 'Nodes' that encapsulate readily available pieces of functionality from a 'Palette' into a 'Flow', configure their behavior and deploy the flow into the Node.js based runtime with a click on a button. For example, the Twitter node knows how to perform the required OAuth authentication flow and how to talk to the Twitter REST API. Developers are shielded from all the integration details.

A QCon attendee, David Laing, skipped the next session after Nick's presentation to put Node-RED to the test:

Node-RED is an intriguing open source solution for 'If This Then That' workflows. I've been able to construct an alerting workflow that pulls in data from our monitoring API and generates an alert when some condition is met, in less than two hours.

The lightweight runtime is usually run standalone, but can be embedded into other Node.js applications too, a recently added headless mode also allows running it without its UI.

Available node types cover a wide range of functionality and are presented in the palette under different categories depending on whether they offer inputs, outputs, functions or specific integrations, for example:

  • Hardware – Rasperry Pi, BeagleBone Black, Arduino
  • Network – HTTP, TCP, UDP, MQTT, WebSocket
  • Parsers – CSV, JSON, XML
  • Transformations – JavaScript Functions, Mustache Templates
  • Social – Twitter, Twillio, Email, IRC, RSS, XMPP
  • Storage – Filesystem, MongoDB, MySQL, PostgreSQL, Redis
  • Analysis – Sentiment, Statistics

The 'Function' node runs user-defined JavaScript in a sandbox to transform incoming messages (JavaScript objects) to possibly multiple outputs. An 'Inject' node allows triggering of flows manually or repeatedly and a 'Debug' node renders its input to the editor's debug panel.

New node types can easily be created and are comprised of one JavaScript file which defines the server-side behavior and one HTML file which defines the node's user interface in the editor. They can extend the range of palette nodes to add new capabilities by using one or more of the tens of thousands of modules available in the Node.js package repository.

Node-RED's user interface offers multiple workspaces to edit different flows in parallel, import of flows from and export to the clipboard and a built-in library. Flows are represented in JSON to ease serialization and exchange, a respective JSON structure can even be dragged and dropped onto the Node-RED editor directly. They can be shared with other users by adding them to the public Flow Library, which creates a private Gist on GitHub on behalf of and owned by the submitter.

The project's source code and issue tracking is available on GitHub, with a collection of extra nodes in a separate repository. The documentation is hosted on its main site, progress and updates are communicated via a blog and a Twitter presence, and an active Google group enables more involved community participation.

Rate this Article

Adoption
Style

BT