Skip to Content
Node.js for Embedded Systems
book

Node.js for Embedded Systems

by Patrick Mulder, Kelsey Breseman
October 2016
Intermediate to advanced
266 pages
5h 45m
English
O'Reilly Media, Inc.
Content preview from Node.js for Embedded Systems

Chapter 9. Exploring Network Protocols

Network protocols are an important piece of a connected system. Network protocols define rules about how devices at different locations should communicate.

Using a weather station as an example, we will discuss different roles that devices can play in a network. The Hypertext Transfer Protocol (HTTP) is based on requests and responses.1 When a weather display requests information from a server, the embedded device acts as client. When an embedded device provides weather data, it can act as server. Sometimes, a device can be both client and server.

While HTTP is stateless, other network protocols support maintaining “connections” between devices. For example, with the transmission control protocol (TCP) or websockets, transmissions of data packets can happen without prior requests. The WebSocket protocol is particularly popular for pushing data to a web browser—for example, whenever new data is available.

In the Node.js ecosystem, there are libraries to work with all kinds of network protocols. Support for HTTP and TCP comes in the form of Node.js core modules. For the WebSocket protocol, you can fetch open source libraries via npm.

Another important network protocol is the MQTT protocol, which is used to send messages across networks. MQTT will be discussed in Chapter 11 in the context of cloud services for connected devices.

The Hypertext Transfer Protocol

HTTP describes the transfer of state between client and server. HTTP is one of the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Distributed Systems with Node.js

Distributed Systems with Node.js

Thomas Hunter

Publisher Resources

ISBN: 9781491928981Purchase bookErrata Page