Real-time Full Duplex Communication Over the Web (Computer Project)

Download Project:

Fields with * are mandatory


As the web browser becomes an increasingly powerful tool for the average web user, with more features and capabilities being developed constantly, the necessity to determine which features perform better than others in the same area becomes more important.

This thesis investigates the performance of three separate technologies used to achieve full duplex real time communication over the web: short polling using Ajax, server sent events and the WebSocket protocol. An experiment was conducted measuring the performance over three custom built web applications (one per technology being tested), comparing latency and number of HTTP requests over 100 messages being sent through the application.

Additionally, the latency measurements were made over three separate network conditions.The experiment results suggest the WebSocket protocol outperforms both short polling using Ajax and server sent events by large margins, varying slightly depending on network conditions.


HTTP is a request/response protocol under typical operation the client establishes a connection  with  a  HTTP  server  and  requests  a  resource. The server  responds  with  the requested resource and the connection is terminated. In the standard HTTP model, the server cannot initiate a connection to a client nor send an HTTP response that has not first been requested thus, asynchronous communication between a server and client is not possible (Loreto, Saint-Andre, Salsano, & Wilkins, 2011).

Repeated Polling:

Repeated polling essentially means that the client repeatedly sends requests for resources from a web server and compares them to the latest fetch to see if there’ve been any updates (Pimentel & Nickerson, 2012) . If any updates are detected, the data is handled by the client.

Typical Short Polling Operation.

Typical Short Polling Operation.

Continuous Connection:

Continuous connections attempt to circumvent the typical request response structure entirely, instead replacing it with a continuous connection that is kept open indefinitely(Loreto, Saint Andre, Salsano, & Wilkins, 2011). The WebSocket  protocol and Server Sent Events are two examples of technologies using continuous connection.

Web Servers:

Since more traditional web servers (Apache, IIS) do not typically have native support for the more recent inventions in the area of real time communication technology, the experiment applications in this project will run off of Node.js.


The web browser is rapidly becoming a ubiquitous tool for doing most anything online. In the past, multiple desktop based applications have been required for performing different tasks, such as real -time voice communication, online gaming or video streaming. With the advent of a number of technologies designed to allow real-time full duplex communication over the web, all of these tasks can now be done directly through a web browser(Qurashi & Anwar, 2012).

This project aims to answer to central questions:

  • Which  one  of  these  web  technologies  perform  the  best  when  trying  to  achieve  full duplex real time communication?
  • How does network environment affect their performance?


In order to test and compare the performance of the a fore mentioned technologies, an experiment was chosen as the methodology to be used because it suits the purpose of the evaluation well. It offers a high level of control while providing the tools necessary to make an accurate evaluation and comparison between the given technologies (Wohlin, Runeson, Höst, Ohlsson, Regnell, & Wesslén, 2012).


In this section, the implementation of this thesis project will be described. First, a literature review will be given, detailing some of the inspirational sources used for this project. After this, a brief description of the pilot study that was performed will be given, followed by a thorough explanation of how the experiment applications were built and how the measurements were performed.

Literature Review:

This project’s design and structurewas inspired by a number of different previous projects scientific papers, websites and applications. Amongst others, this includes the papers and articles mentioned in section 3.1of this thesis. Aside from the ones listed there, some other sources have been used as inspiration for this project. A few of those sources will be described here.


Pilot Study:

In order to determine if the chosen methodology could be used to effectively test the different web technologies, a pilot study was conducted . This pilot study functions as a minimal version of the final experiment, with only a small portion of the functionality included in the  final experiment.

The functionality for each application is nearly identical: a button with the label “Ping!” is presented to the user. When the button is pressed, a ping message is sent to the server when a response is received, an output is displayed to the user, containing 4 values:

  • The timestamp for when the message was sent from the client
  • The timestamp for when the message was received by the server
  • The timestamp for when the response was received by the client
  • A calculated latency, achieved by subtracting the last and first timestamp

Building the Experiment Applications:

As mentioned earlier in this thesis, the experiment was conducted by measuring the performance of three distinct web technologies: Ajax, Server-Sent Events (SSE) and WebSocket.

To this end, three separate applications were constructed, one for each technology. In this section, an overview of the preparatory work for building the applications will be given, followed by more detailed descriptions about how each individual application was built.

Performing the Measurements:

Two things were measured on all three applications: message latency and number of HTTP connections. In this chapter the procedure of performing these measurements will be described.



All measurements were conducted on machines with the following specifications:

  • The server machine is a stationary PC with an Intel Core i5-2500K  CPU  running  at 3.30GHz. The machine has 12GB ram and runs Windows 7 Ultimate. The application server software runs on node.js version 0.10.25 . This machine also acts as a client on the local machine measurements
  • The  client  machine on the LAN and 4G measurements is a Lenovo E530 Thinkpad laptop, with an Intel Core i7-3612QM CPU running at 2.10GHz. The machine has 8GB RAM and runs Windows 7 Home Premium, 64-bit  edition.  The client tests were performed in the browser Google Chrome version


In this chapter, the analysis from the previous chapter will be summarized and put in relation to the problem formulation of this thesis. The results will be further discussed, with recommendations and advisement to any web developer considering these technologies. Finally, a look at the possibilities for future work will be given.

Source: Hogskolaniskovde
Author: Elof Bigestans

Download Project

Download Project:

Fields with * are mandatory