April 17, 2015


Unleashing the power of HTML5 WebSocket for Internet of Things

Introduction to Internet of Things (IoT)

Before I get into explaining how HTML5 powers IoT, let me explain what IoT is. IoT - sometimes referred to as Internet of Objects - is likely to change everything as we know it, including ourselves! This may seem like a bold statement, but considering the impact that the Internet has already had on education, communication, business, science, government, and humanity, we can  clearly see that the Internet is one of the most important and powerful creations in all of human history.

IoT is a super highway of the Internet, connecting various devices together. It’s a network of various physical devices embedded with electronics, software, sensor and Internet connectivity.

Some examples of physical objects could include things such as:

  1. Home appliances
  2. Smart buildings
  3. Car infotainment systems
  4. Security systems
  5. Fitness monitor gear
  6. Smart watches

To put it simply, tomorrow’s world will connect all aspects and behaviors which could radically change the way we look at things. Here are a couple of examples:

  1. In the world of IoT, cattle such as sheep and cows can be tracked and monitored through implant sensors in their ears. This will allow farmers to monitor their health and track their movement, ensuring a healthier, more plentiful supply of wool and milk.
  2. Even something as small as our toothbrush can be embedded with micro sensors which could give us data concerning the health of our teeth.
  3. Our refrigerator could send us a message when we run short of milk so that we can pick up a carton on our way back home.
  4. A small wearable device can detect the vital signs of the elderly and send an alert to a healthcare professional when a certain threshold has been reached, or when the person has fallen or can’t get up.

IoT goes far beyond machine-to-machine or device–to-device interaction. It is a paradigm of many objects that surround us and/or will be on the network in one form or another. Radio Frequency Identification (RFID) and sensor network technologies will rise to meet this new challenge in which information and communication systems are invisibly embedded in the environment around us. This will result in the generation of enormous amounts of data, which will need to be stored, processed and presented in a seamless, efficient, and easily interpretable form. And this is where HTML5 WebSocket comes into the picture.

HTML5 and WebSocket Contribution

Let’s take a look at how HTML5 can contribute to technology transformation. It is, in fact, going to play a very important role in implementing IoT. HTML5 will act as a bridge to link IoT and WebSocket. IoT-based applications demand reliable, real-time communications with near-zero latency; not just broadcast, but bidirectional communication is what is required and WebSocket provides the perfect environment for this. A WebSocket is an extremely important tool for real-time communication across the internet.

A WebSocket is a bi-directional communication protocol which has emerged recently with the introduction of HTML5. A WebSocket operates over TCP as an upgrade to a standard HTTP connection. This enables full-duplex message-based communication between the client and server using a single socket, and is exposed using the JavaScript interface of HTML5. This protocol is not just an enhancement of the current HTTP protocol; it is enormously advanced, especially for real-time, event-driven communication.

WebSocket communication presents a suitable protocol for the IoT environment where bundles of data are transmitted continuously within multiple devices. A WebSocket makes server and device communication easy. A server needs a WebSocket library to be installed and we need to have the WebSocket client and web browser installed on the client or device that supports WebSocket. The messages are transmitted using binary data that is encoded using JSON.

Using WebSocket, we won’t have to pool communication data like a conventional API call does. Rather, we can have a real-time push communication setup between the server and the device. We can therefore send and receive high amounts of data in micro seconds.

The diagram below explains the new dynamic of IoT and WebSocket communication.

Figure: IoT using HTML5 Web sockets



To know more on IoT Examples please visit us.