What’s in HTTP/2 for the Internet of Things? 1/2

If you followed this blog you probably know that the motto of the Web of Things community is to re-use Web protocols to build a truly interoperable Application Layer for the Internet of Things. One of the key protocols we are talking about is HTTP currently massively deployed on the Web in its 1.1 version. HTTP/1.1 is a great protocol when used correctly to build Web Services as illustrated in this book! However, it dates back from 1999. Remember this time? Back then we were using Windows 95, wired phones to call each other and the IoT term had just been coined!

Clearly, the Web evolved tremendously since then and the requirements for scale, real-time, security and performance changed quite drastically. As a result the Internet is about to fully embrace a revolution called IPv6 and the Web another called HTTP/2. The new protocol wasn’t designed specifically for the IoT but the creators of this new protocol clearly took into account some of the needs of the IoT. HTTP/2 focuses on a number of improvements over HTTP/1.1. Let’s look at the ones that are especially relevant in an IoT context:

Performance improvements

This new version of HTTP allows multiplexing responses: that is sending responses in parallel. This fixes the “head-of-line blocking” problem of HTTP/1.x where only one request can be outstanding on a TCP/IP connection at a time. Furthermore, it fosters clients and servers to use a single TCP connection on which requests and responses are sent in streams.

This is an interesting feature for the WoT as it leads to a more efficient use of connections, which reduces the overhead of HTTP. It also leads to faster transmissions and hence potential savings in terms of battery power required to communicate. Want to see this live? Akamai developed a simple page that lets you experiment these improvements.

More efficient formats

HTTP/2 also introduces compressed headers using a very efficient and low memory compression format, unlike GZIP, the most common compression format used on top of HTTP. The compression format is called HPACK, Header Compression for HTTP/2.  This new format reduces the size of each HTTP requests and responses. Additionally, while HTTP/1.1 was an ASCII protocol, i.e., a protocol transmitting ASCII characters, HTTP/2 uses binary framing, i.e., transmits binary streams of data. Binary protocols are more efficient to parse and more compact.

All of this is particularly interesting for the “Web of resource limited Things” as it means the size of packets is significantly smaller, allowing for devices with limited RAM to happily deal with HTTP/2.

Server push

Finally, HTTP/2 introduces the notion of server push. Concretely this means the server can provide content to clients without having to wait for them to send a request. If you remember, in we discussed the needs for Things to push events rather than being requested for data in several previous posts. To implement this we quite often use a Web protocol than HTTP called WebSockets. It turns out that server push in HTTP/2 could be a good way of achieving similar results!

HTTP/2 and the Web of Things

This overview of the features of HTTP/2 and what they mean for the Web of Things is by no means complete but it shows that the future of the Web will make an even better Web of Things. Interestingly enough, if you created a RESTful API based on HTTP/1.1 for your Things, you will not have to change your API at all: the underlying implementation of HTTP will change but not the API you build on top as the semantic of HTTP remain unchanged with HTTP/2!

The HTTP/2 specification was officially accepted in February 2015 and several browsers such as Chrome, Firefox and Opera started supporting it. This concretely means that the standard is being globally deployed and will soon make the Web of Things more efficient! It is also worth noting that the protocol benefited from a unique test drive over the past few years. Indeed the Spdy protocol Google crafted shared a similar aim and a similar design. As HTTP/2 is being deployed Spdy will progressively be retired a very approach and a good news for truly open Web standards.

CoAP vs HTTP/2?

In a number of previous posts we talked about a Web inspired application protocol for the Internet of Things called Constrained Application Protocol (CoAP). CoAP is interesting because it is using a REST approach but instead of using the HTTP implementation of REST it re-implements it in a way that is more adapted to very constrained devices.

What’s interesting is that a significant number of the improvements CoAP brings are also covered by HTTP/2 (e.g., binary format, header compression, etc.). However, CoAP goes an extra mile and provides further optimizations such as the use of less-resource heavy security (using DTLS), resource discovery mechanisms or the use of UDP instead of TCP. UDP is interesting for very constrained Things as the protocol is less resource hungry than TCP. UDP is not only interesting for Things but also for IoT Clouds as it is easier to scale because it does not require an actively open connection like TCP. As a consequence UDP will probably play a role in the future of the Internet and the Web of Things and it could also be through technologies like CoAP or other UDP based protocols such as Web RTC (even if there is yet to be seen if there is value beyond the hype!).

The drawback of the CoAP approach from a pure Web of today view point is that CoAP is not supported out-of-the-box by Web browsers (mainly because of its use of UDP) but can be relatively easily translated to HTTP via a software proxy. Nevertheless, as you implement the Web of Things, these technologies mentioned here are definitely worth following: as they mature and become widespread, they will surely have their say in the future of the Internet of Things, meanwhile let’s experiment with HTTP/2 for the Web of Things.

In the next post…

In a next post we will show you concrete examples of connected Things offering APIs via HTTP/2. If you can’t wait until then dig deeper into HTTP/2 and download this nice and free e-book excerpt from High Performance Browser Networking. You should also have a look at HTTP/2 implementations such as the node-http2 Node.js module which we readily tested on a number of platforms such as the Raspberry Pi.

More in the Building the Web of Things book!

This post is an extract from our book “Building the Web of Things” where we speak about HTTP/1.1 and HTTP/2 and WebSockets for Things, building bridges to CoAP, MQTT all illustrated with concrete Node.js code deployed on a Raspberry Pi.

Get the book


You may also like...

12 Responses

  1. ivistroy.ru says:

    This article will help the internet users for building up new weblog or even a blog from start to end.

  2. I have learn some good stuff here. Definitely price bookmarking for revisiting. I surprise how a lot attempt you set to make this type of fantastic informative site.

  3. Rafael Poche says:

    I definitely wanted to post a quick word so as to express gratitude to you for those awesome instructions you are sharing at this site. My particularly long internet investigation has at the end been honored with excellent strategies to write about with my friends and classmates. I would point out that many of us readers are really blessed to dwell in a superb community with many brilliant professionals with interesting advice. I feel really happy to have used your web site and look forward to tons of more amazing times reading here. Thanks a lot once again for all the details.

  4. Vip777 says:

    fantastic issues altogether, you simply gained a new reader. What may you recommend about your put up that you simply made some days in the past? Any sure?

  5. cammatch says:

    Keep up the excellent work, I read few posts on this internet site and I conceive that your web blog is real interesting and holds circles of fantastic info .

  6. Woh I enjoy your articles, saved to my bookmarks! .

  7. You should take part in a contest for the most effective blogs on the web. I will advocate this site!

  8. That is really fascinating, You are a very professional blogger. I have joined your rss feed and sit up for in quest of more of your excellent post. Also, I have shared your site in my social networks!

  9. turn dispo says:

    Pretty nice post. I just stumbled upon your weblog and wanted to say that I have truly enjoyed surfing around your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very soon!

  10. turn carts says:

    hello there and thank you for your information – I’ve certainly picked up anything new from right here. I did however expertise several technical points using this site, as I experienced to reload the web site lots of times previous to I could get it to load properly. I had been wondering if your web hosting is OK? Not that I am complaining, but slow loading instances times will often affect your placement in google and could damage your quality score if advertising and marketing with Adwords. Well I’m adding this RSS to my email and could look out for a lot more of your respective interesting content. Make sure you update this again soon..

  11. excellent issues altogether, you just gained a new reader. What might you suggest about your put up that you made some days in the past? Any positive?

  12. Wonderful blog you have here but I was wondering if you knew of any discussion boards that cover the same topics discussed here? I’d really love to be a part of group where I can get feed-back from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *