Rise of websockets

The web was built around the idea that a client’s job is to request data from a server, and a server’s job is to fulfill those requests. This paradigm went unchallenged for a number of years but with the introduction of AJAX around 2005 many people started to explore the possibilities of making connections between a client and server bidirectional.

Web applications have grown up a lot and were now consuming more data than ever before. The biggest thing holding them back was the traditional HTTP model of client initiated transactions. To overcome this a number of different strategies were devised to allow servers to push data to the client. One of the most popular of these strategies was long-polling. This involves keeping an HTTP connection open until the server has some data to push down to the client.

The problem with all of these solutions is that they carry the overhead of HTTP. Every time you make an HTTP request a bunch of headers and cookie data are transferred to the server. This can add up to a reasonably large amount of data that needs to be transferred, which in turn increases latency. If you’re building something like a browser-based game, reducing latency is crucial to keeping things running smoothly. The worst part of this is that a lot of these headers and cookies aren’t actually needed to fulfil the client’s request.

What we really need is a way of creating a persistent, low latency connection that can support transactions initiated by either the client or server. This is exactly what WebSockets provides.

WebSockets is a technology designed to simplify much of the complexity around bi-directional, full-duplex communications channels, over a single Transmission Control Protocol (TCP) socket. It can be implemented in web browsers, web servers as well as used by any client or server application.

Both the WebSocket API and the WebSocket protocol are standardised which means the web now has an agreed standard for realtime communication between Internet clients and servers. Originally considered a browser technology, WebSockets are reaching far beyond just web browsers and are becoming a cross platform standard for realtime communication between client and server. WebSockets are supported in almost all modern web browsers. The only exceptions being the Android browser and Opera Mini.

On the surface, most people are not convinced that WebSockets really add much value because the gain over HTTP is not really that convincing to the naked eye. They probably right for the standard web application where real time engagement is not a necessity. However, once this becomes an important trait, HTTP just won’t cut it. The video below shows why.

Bi-directional communication means not only pushing real-time messages from the server to the client, but also the reverse. This may seem awkward, as sending messages from the client to the server at the client’s discretion has always been the normal behavior of HTTP! In reality, the aspect that is considered new and important has been the ability to send such reverse messages with low latency and high frequency. In most cases HTTP can stream messages with low latency and high frequency from the server to the client, but it always requires a full round-trip to send messages from the client to the server. This is a constraint imposed by how browsers and proxies are implemented. And this is one of the reasons that led to the WebSocket specification, aimed at enabling full-duplex communication over a single TCP connection (the other main reason being to prevent intermediaries from buffering the streaming content, as it happens in some cases with HTTP).

WebSockets represent a big step in the evolution of the internet. Just as AJAX changed the game in the mid 2000s; having the ability to open bidirectional, low latency connections enables a whole new generation of real-time web applications.

At Software Arkitex we are taking real time engagement and bidirectional communication seriously. With the IoT (Internet of things) on our door step, we can only see this being amplified exponentially. We have embarked on a roadmap to find a suitable technology partner and we are are very close to making an announcement on this. Watch this space!

The question is…are you plugged in? Visit for more information.