Hesam Seyed Mousavi, March 25, 2015
The Internet is one of the most important inventions in history, and it has changed our lives for the better in many ways. For social creatures such as humans, nothing could be better than a fast method of communication with the world that enables multimedia content delivery with almost no delay.
In its few decades of existence, the Internet has evolved from a basic set of network clusters with simple operations to the foundation of almost everything in our world, providing opportunities to make billions of dollars.
The Internet started as a simple set of clusters with some computers connected to perform basic operations. It quickly became a very sophisticated network of servers all around the world that serve hundreds of millions (even billions) of clients.
There have been different kinds of changes on this worldwide network in different domains. In one area, Internet connections became faster and more reliable, enabling users to download and upload larger content so that it is now possible for users to download and upload high–quality multimedia content (e.g., videos) from their mobile Internet connections. It has also opened new doors for content providers and consumers.
Why the Client-Side Experience Is More Important than Ever The concept of user has become the most important concept in today’s Internet. Almost all businesses, regardless of their size, know how important the user experience can be. They have moved their focus to making products, technologies, and software that is intuitive and simple enough to attract almost any user regardless of age, gender, cultural background, and so on.
An important part of the user experience is the speed of delivering content. Traditionally, the Internet was a set of web pages served on servers and received by clients. These pages included many static pages that could not react dynamically to users’ actions and dynamic pages that could render a dynamic content based on the inputs provided by users. Users had to send their actions to servers or request a particular Uniform Resource Locator (URL) from the server to receive HTML content. This was a very simple model and lacked the sophistication seen in modern web sites.
This issue led web developers and designers to start thinking about sending the content from servers to clients as it arrives in real time, or at least invent mechanisms that simulate such a behavior. This process is called real–time web application development.
Real–Time Web Application Development
The term real-time software refers to the type of software that is subject to a soft or hard time constraint. By the nature of its business domain, this type of software must complete its processing within a particular timeframe. This time constraint can be strict to make it hard real-time software or flexible to make it soft real-time software. For example, aerospace software can be hard real-time software because it must finish its execution within a defined time interval; otherwise, operations might fail, and people’s lives can be in danger. In contrast, video players can be soft real-time software because it is not mission-critical if the processing does not finish on time (although it is important to process the videos in time to display them to users).
Although real-time software and real-time computing have been around for a long time, the term real-time web is relatively new. This concept, which was introduced in the past few years, focuses on real-time delivery of content to clients as soon as it is available. The real-time web is similar to soft real-time software because the delivery of content from the information source to consumers should occur in a short period of time to be considered real time (from a few milliseconds up to 1 second).
The real-time web was embraced by social networks and their need to update users with frequent status updates and content changes by friends and peers. Facebook and Twitter were among the first major sites on the Internet that pioneered in this area and implemented real-time web features.
Although the real-time web is primarily applied to soft and small updates to clients with short status updates, news headlines, and similar content, it is now also used for other purposes, such as real-time searching (more details to come in the next section). Google incorporated such features to provide real-time updates to its search results as they become available.
Examples of Real–Time Web Application Development
This section focuses on showcasing a few common examples of the real-time web to describe it and the applications it can have. One common misbelief about real–time web development technologies including SignalR is that they are designed mainly for building chat applications. The examples shown here correct this by describing different practical applications for these technologies.
The real–time notification feature on Facebook (see Figure 1-1) is one of the best examples of the real-time web, and Facebook is a pioneer in this area. If you have a Facebook account, you have noticed the red color counter of new notifications being increased in real time while a toast appears in the bottom-left corner of new actions.
Whenever there is a new like, comment, post, or other type of notification associated with your account, you see a notification toast in the bottom that appears and disappears after a few seconds. At the same time, the counter of new notifications in red is updated. Facebook is using a combination of WebSockets and long polling to implement this feature. Note that Facebook uses a similar asynchronous mechanism to implement its chat system (in fact, Facebook chat and real-time notifications were rolled out together in early 2008). Facebook later enhanced its real-time features to include real-time updates to different parts of the site, such as new comments added to posts that appear in real time to users.
Such a sophisticated and reliable real–time web implementation for Facebook has an important value for its business. With the large number of users and high demand for the huge content provided by hundreds of millions of active users, the user experience is significantly improved by integrating such a real–time web ecosystem.
Technology-wise, Facebook has employed a very sophisticated custom implementation to achieve its unique business goals for the real-time web that relies on pushing the content from servers to clients. Facebook had to consider several factors, such as the large number of active publishers as well as consumers, along with keeping its data centers in sync and reducing the latency for users who are scattered throughout the world.
Another popular social network using quick status updates is Twitter, which receives frequent updates from its users. Each user can then have many followers who want the most recent updates from that user and other users they are following. The speed of delivering these short status updates to clients is of vital importance for Twitter’s business because it can improve the user experience significantly. Just imagine how frustrated Twitter users would be if they had to refresh their Twitter feed every time they wanted a new update.
Twitter employs a real–time web infrastructure to display the most recent updates to users in real time (see Figure 1-2). This implementation is Twitter’s custom implementation that fits its needs. As new updates arrive in the user’s feed or search results, the user interface is updated with the counter of new updates that ask the user to click the counter link to fetch the most recent updates with an AJAX call (rather than refreshing the whole page).
With the very fast pace of content production on the Internet, especially for trending topics, new articles and news items become available very quickly. Google uses its powerful indexing tools to capture these updates quickly. With the traditional user interface structure, after a user searched for a particular keyword, the results were presented from the original state of content repository in the Google database. To provide a better user experience, Google offered real–time search result updates in which search results were updated as new items became available, and users could see the most recent items.
Although Google was using its own real–time web implementation for real–time search results, it closed this feature in 2011 because the deal with Twitter expired for displaying the latest tweets in real time.
Another great example of the power of the real-time web and its impact is Google Docs, in which users have access to an online version of document-editing software for word processing, spreadsheets, and slides. Not only can users edit their own documents with the great features provided but they also can share their documents with others. The real power of the real-time web shines here: the updates made by one user are reflected in other users’ displays in real time, so multiple parties from different locations are allowed to collaborate on writing and editing documents.