When writing about Comet technologies, sometimes we tend to be a bit abstract and theoretical. In this case, I would like to focus on concrete working examples. So concrete that they actually run inside this very article…
Solutions for the online trading of securities were the first to adopt Push Technology and the Comet paradigm. In my case, it was actually the requirements of online trading systems that drove the technology. Back in 2000, when I started designing and prototyping Lightstreamer, I had had strong inputs from banks that wanted to get rid of Java applets. At that time, real-time market data (stock quotes and news) was delivered through the Internet to thick desktop applications or to Java applets running inside the browser. The trend of moving from desktop to browser-based applications was already massive and, at the same time, the decline of Java applets had begun (for some well known reasons, including: incompatible runtimes, start-up slowness, expensive maintenance, layout mismatch, etc.).
Nine years ago, the only ready-made solutions for pushing data to a browser without using applets or plug-ins were Pushlets (open source) and Lightstreamer (commercial). Starting from 2006, when the term “Comet” was coined, many more players, both open source and commercial, has come into the arena, making modern Push Technology more and more visible and recognized in the mainstream.
Banks and financial institutions are still the most demanding Comet-technology consumers. Their requirement of pushing real-time market data to the browser is still there, with additional requirements of low latency, high scalability, bandwidth throttling, and the support of multiple client-side technologies, including Ajax, Flex, Silverlight, and iPhone.
In recent years, many online gaming companies, especially in the UK, have found a great technological ally in Comet. Spread betting in particular, which is often on the boundary between finance and gaming, shares the same requirements of more traditional online trading applications. Many other types of games and auctions are progressively adopting Comet technologies.
The live example above is based on the most typical Lightstreamer demo. You can check out the full source code and explanation.
Chat applications have often been considered the “Hello World” of Comet (even if in the past I preferred to publish an actual “Hello World” application…). One of the first players to propose a full-fledged messenger application based on the Comet paradigm was Meebo. Previously, web chats relied on page refresh or applets/plug-ins. Soon after the success of Meebo, the arena of new generation chats/messengers quickly became crowded. It is interesting to notice that the widespread success of Comet chats arrived with the in-house engineering made by the major social companies. Google Talk inside Gmail and the Facebook chat are two clear examples.
Chat and messenger Comet applications are much simpler and lighter on requirements with respect to online trading Comet applications. For instance, bandwidth throttling and very low latency are generally not really necessary. Even if the number of concurrent users can be higher than trading applications, the event throughput for each user is much lower. This means that the overall outbound message throughput is generally much higher in trading applications (you can have tens of messages per second per user in trading vs. one per second or less in chats). So, the only requirement for chat-oriented Comet servers is to scale well over high numbers of TCP sockets. While Meebo started with lighthttpd, the major social sites developed their servers internally, more than using off-the-shelf products.
The live chat example above is based on another Lightstreamer demo. You can check out the full source code and explanation.
Even More Chat
The launch of Google Wave pushed real-time interaction a step further. One of the features of Google Wave that caused most hype is the character-by-character real-time dispatching of messages. Well, let me mention immodestly that here at Lightstreamer we publicly demonstrated this feature in February 2006, when my colleague Simone Fabiano came up with this idea, based on early desktop chat platforms, and implemented a demo .
Above you can play with that demo, which is quite effective (what do you think?). Just type something in any of the two “broadcast” fields. Your message will be pushed in real-time as you type it to all the browsers connected to this page. For the best experience, open this page in two different browsers, or ask a colleague to visit this page in their browser as well.
You can check out more information on this demo.
From a more general perspective, the Comet paradigm is the right solution when you need to monitor the state of any variables in real time. There exist many kinds of monitor consoles. There are consoles for monitoring software processes, hardware components, the physical environment (e.g. atmospheric or geological variables), transportation systems, etc. These consoles are often web-based and they usually provide the current snapshot for a given set of variables. Again, being able to push updates for such variables in real-time, without a manual page refresh or traditional Ajax polling techniques, will provide a dramatic improvement to the system.
Above you can see an example of a tiny monitor console, which shows some real-time variables of an actual Lightstreamer Server instance. The demo is pushing updates on: the free memory on the server, the current number of connections to the server, the current total outbound bandwidth used by the server, and the total number of bytes pushed since server’s startup.
I focused on three typical examples of real-time applications. Many more application domains can benefit from the Comet paradigm. The raise of the number of good Comet servers on the market, both free and commercial, is helping many application progressively transition to the Comet-driven real-time web.
Many other online examples are available from the Lightstreamer gallery, covering several different client-side technologies (including Ajax, Flex, Silverlight, .Net, Java, and iPhone). Below is the full list to date:
- Basic Stock-List Demo
- Stock-List Demo
- Framed Stock-List Demo
- Bandwidth Demo
- Simple Grid Demo
- Chart Demo
- Basic Portfolio Demo
- Portfolio Demo
- Drop-Down Demo
- Basic Chat Demo
- Basic Instant Messenger Demo
- Round-Trip Demo
- Monitor Console Demo
- Web Telemetry Demo
- RSS News Reader Demo
- Mini Stock-List Demo
- Mini Chart Demo
Other Ajax Frameworks
- TIBCO General Interface :: Basic Stock-List Demo
- TIBCO General Interface :: Advanced Stock-List Demo
- Dojo :: Stock-List Demo
- Microsoft ASP.NET AJAX :: Stock-List Demo
- OpenAjax Alliance - InteropFest 1.0
Flash, Flex, and Air
- Flash Bridge :: Basic Demo
- Flash Bridge :: Stock-List Demo
- Flex :: Stock-List Demo
- AIR :: Stock-List Demo