Oct 1

 

Jonas Jacobi gave a presentation, Kaazing Gateway: An Open Source HTML 5 Websocket Server, at JAOO this past Monday and received the vote for the conference’s most popular talk. Congratulations Jonas!


Sep 17

 

In a recent Ajaxian.com post entitled Comet and Highly Interactive Websites - Joe Walker, Joe Walker of Site Pen elaborates on some of the technical and performance aspects of developing and deploying highly interactive Comet-enabled sites. Joe also declares WebSockets is a “cleaner solution” for solving the Comet problem.


Sep 14

 

Just a quick heads up to those attending JAOO on Sept. 29th. I will be giving a 3 hour tutorial that introduces participants to WebSockets. This a great opportunity to get hands-on with this emerging standard, so be sure to register. I look forward to seeing you there!


Sep 10

Kris Zyp of Site Pen recently posted an interesting article on Comet Daily, which covers the topic of cross-site Comet options. He calls out a few notable solutions, and also notes WebSocket as:

WebSocket is almost certainly the most comprehensive solution for Comet.

One fault with the article is the statement “I would expect to see this in the generation of browsers after next (FF4 or FF3.2, IE9, Safari.next)”, which implies there is a long wait for WebSocket support. Fortunately, this could not be farther from the truth. Starting Sept. 29th, Kaazing with its Kaazing Enterprise Gateway offering will provide native support for WebSockets, as well as a JavaScript emulation layer for more antiquated browsers such as IE 5.5. This means that any modern browser can take advantage of WebSockets with in a few weeks time.


Sep 5

Starting Sept 16th Kaazing will kick off its world tour. See the list below to find out if we will be visiting a city near you.

  • JavaZone - Oslo, Norway - Sept. 17 - 18
  • Web 2.0 Expo - NYC - Sept. 17 -19
  • JAOO - Denmark - Sept. 29 - Oct. 3
  • AJAX World - Santa Clara, CA - Oct. 20 - 22
  • AJAX in Action - Mainz, Germany - Oct. 28 - 31
  • W-JAX - Munich, Germany - Nov. 3 - 7
  • ORDEV - Malmo, Sweden - Nov. 19 - 21
  • QCon - San Francisco, CA - Nov. 19 - 21
  • IndicThreads - Pune, India - Nov. 25 -27
  • JAX Asia - Singapore - Nov. 25
  • JAX Asia - Kuala Lumpar - Nov. 26 - 27
  • JAX Asia - Jakarta - Nov. 28
  • Javoxx - Antwerp - Dec. 8 -12


Sep 5

 

In a recent interview with Tech Republic, Ian Hickson of Google and the HTML 5 spec lead, stated:

My own personal favorite feature is probably the Web Sockets API, which allows two-way communication with a server so that you can implement games, chatting, remote controls, and so forth.

Ah.. its good to be loved. ;-)


Sep 5

 

Jonas Jacobi, Kaazing’s CEO, will be delivering a three day course through Kaazing’s partnership with SkillsMatter in London on October 6th, 2008. The course is entitled “Comet Evolved: HTML 5 Web Sockts & Server-Sent Events.” Below is an exert from the course description, for more information you can visit the course web site here.

This highly practical 3-day class on Comet and HTML 5 Web Sockets and Server-Sent Events (SSE) for Real-time We applications was designed by Kaazing’s Jonas Jacoi, CEO and co-founder of Kaazing corporation. This course will teach you how to create next generation real-time Web 2.0 solutions, using HTML 5 Web Sockets and SSE that work today.

Come and learn about Comet architecture, HTML 5 Web Sockets and SSE. With these new standards, the browser can now enjoy the first-class citizenry of network communications that has long been enjoyed by desktop applications. You will learn how to use the emerging standards to build scalable, mission critical rela-time Web 2.0 applications such as:

* Trading System Clients
* Online Betting Applications
* Social Chat Solutions
* Performance Monitoring Applications
* RFID and GPS Tracking Applications
* Sports and News Broadcasting Applications

Upon completion of this course you will know how to create your own scalable, real-time Web applications with the latest HTML 5 standards-based technologies.

Learn How to:

* Decide when, why and what Comet-style technology to use and its implications on your architecture
* Setup and configure an enterprise Websocket server and development environment
* Use client-side API’s to communicate directly with back-end systems such as JMS, XMPP, STOMP and SMTP
* Master the fundamental technologies used to push information to Web clients using standard technologies
* Design, develop, debug and deploy scalable real-time Web applications
* Address server-side scalability issues with Asynchronous Request Processing (ARP)

LEARN HOW TO:

* Decide when and why to use Comet and its implications on your architecture
* Setup and configure an Enterprise Comet development environment and use Comet APIs
* Master the fundamental technologies used to push information to Web clients
* Design, develop, debug and deploy testable and scalable real-time Java EE applications with Comet
* Address server-side scalability with Asynchronous Request Processing (ARP)


Sep 5

Introduction

AJAX, with its asynchronous updates, enabled a richer user experience on the Web. It accomplished this primarily by obscuring the latency issues that brought a “clunk-ish” feel to traditional Web applications. More recently, Comet reintroduced HTTP-based “push” communications to enable Web applications with real-time events through a medium, namely JavaScript and a variety of transports (e.g. long-polling, forever frames, XHR Streaming, etc.), that is far more accessible than “push” technologies of the late 90's, and which further lessens latency concerns felt by end-users, creating a more dramatic, and interactive Web experience. Both AJAX and Comet can attribute their respective successes to addressing various shorting comings of HTTP communications, whether that be with the introduction of asynchronous requests/responses or server initiated events, but it is the resolution of these trouble areas that have enabled the user experience of the document-driven Web to rapidly evolve.

Today, with the advances brought about by AJAX and Comet, we enjoy the rich Web experience delivered by applications such as Meboo, Gmail with GChat, Google Docs, and Mint.com, but these applications, however impressive, simply represent a tipping point in user experience and, more importantly, still demonstrate a continued lag in the resolution of HTTP's limitations. Such applications approximate the experience afforded by the desktop, but do not deliver an experience that is as equally compelling. Granted, better “eye candy”, as provided by the canvas tag or plugin-based technologies such as Adobe Flex and MS Silverlight, helps to close the gap, but even with better visual effects, latency remains the beast of burden that drags down much of the user-experience delivered over the Internet, and as a result costs the industry money.

Yes, there is something to be said about the old adage “time is money.” Amazon.com, as reported by highscalability.com in a post "Latency everywhere and it cost sales - How to crush it", recently stated that 100 ms of latency costs Amazon 1% of every sale. In the same post, Todd Hoff reported that Google VP Marissa Mayer, at the 2006 Web 2.0 Expo, stated that a half a second delay content delivery is correlated with a 20% drop in traffic at Google. Hoff also references a 2008 report by the TABB Group estimated that a 5 millisecond lag behind competing trading platforms could be as costly as $4 million in losses per millisecond. In short, users respond well to speed, as do our wallets.

Therefore, to further address latency concerns, and bridge the gap between desktop and Web applications, we must look to a new communications paradigm. Fortunately, HTML 5 WebSockets, as defined in the communications section of the HTML 5 specification, represent the next evolution of Web communications. WebSockets provide not only a standard against which Comet- and AJAX-style, or any other RIA application, can be built, but also a socket, native to the browser, that facilitates network programing from the browser with efficient bi-directional (or full-duplex) communication over a single connection, eliminating many of the connection limitations that surround Comet and AJAX. The result is the promotion of the browser and its associated applications to the same citizenship on the network as that of rich desktop applications.

HTML 5 WebSockets: A Better Mouse Trap

The HTML 5 specification introduced the WebSocket interface, which defines a full-duplex communications channel that operates over a single socket and is exposed via a JavaScript interface in HTML 5 complaint browsers. The full-duplex capabilities of Comet and AJAX, unlike WebSockets, are not native to the browser, and rely on maintaining two connections –one for up stream and one for downstream-- in order to stream data to and from the browser. With the introduction of one succinct interface (see Listing 1), we can now divorce ourselves from the mind bending hacks all to often associated with Comet and focus on the task at hand. Furthermore, by moving to a single, streaming channel of communications, we can overcome the insufficiencies of techniques such as long-polling and “forever frames”, and as a result further reduce latency.

JAVASCRIPT:
  1. [Constructor(in DOMString url)]
  2. interface WebSocket {
  3.   readonly attribute DOMString URL;
  4.   // ready state
  5.   const unsigned short CONNECTING = 0;
  6.   const unsigned short OPEN = 1;
  7.   const unsigned short CLOSED = 2;
  8.   readonly attribute int readyState;
  9.   // networking
  10.   attribute EventListener onopen;
  11.   attribute EventListener onmessage;
  12.   attribute EventListener onclosed;
  13.   void postMessage(in DOMString data);
  14.   void disconnect();
  15. };

Utilizing the WebSocket interface couldn't be simpler. To connect to an end-point, just create a new WebSocket instance, providing the new object with a url that represents the end-point to which you wish to connect (See listing 2). Note that a ws:// and ws:// prefix indicate a WebSocket and a secure WebSocket connection, respectively. A WebSocket connection is established by upgrading from the HTTP protocol to the WebSocket protocol during the initial handshake between the client and the server. Once established, WebSocket data frames can be sent back and forth between the client and the server in full-duplex mode. The connection itself is exposed via the onmessage and postMessage methods defined by the WebSocket interface.

JAVASCRIPT:
  1. var myWebSocket = new WebSocket(ws://www.websocket.org);

Before connecting to the end-point and sending a message, you can associate a series of event listeners to handle each phase of the connection life-cycle.

JAVASCRIPT:
  1. myWebSocket.onopen = function(evt) { alert(“Connection open ...”); };
  2. myWebSocket.onmessage = function(evt) { alert( “Received Message:  ”  +  evt.data); };
  3. myWebSocket.onclose = function(evt) { alert(“Connection closed.”); };

To send a message to the server, simply call postMessage and provide the content you wish to deliver. After sending the message, call disconnect to terminate the connection. It really couldn't be much easier.

JAVASCRIPT:
  1. myWebSocket.postMessage(“Hello WebSocket! Goodbye Comet!”);
  2. myWebSocket.disconnect();

One of the more unique features WebSockets provides is its ability to traverse firewalls and routers, a problem area for many Comet-enabled applications. Comet applications typically employ long-polling as a rudimentary line of defense against firewalls and proxies. The technique is effective, but is not well suited for applications that have sub 500 millisecond latency or high throughput requirements. Plugin-based technologies such as Adobe Flash, also provide some level of socket support, but have long been burdened with the very proxy and firewall traversal problems that WebSockets now resolves.

A WebSocket detects the presence of a proxy server and automatically sets up a tunnel to pass through the proxy. The tunnel is established by issuing an HTTP CONNECT statement to the proxy server, which requests for the proxy server to open a TCP/IP connection to a specific host and port. Once the tunnel is set up, communication can flow unimpeded through the proxy. Since HTTP/S works in a similar fashion, support for SSL is inherent. Note that Web sockets are not natively supported by modern browsers, however there are a few vendors that provide implementations that enable today's browsers to take advantage of this emerging technology. Two vendors are Kaazing and its Kaazing Enterprise Gateway offering, due for release in early Fall 2008, and an early stage open source initiative, the Orbited projected, which provides its own Python-based server.

In addition, the WebSocket protocol supports a diverse set of clients (e.g. JavaScript, Adobe Flex, JavaFX, Microsoft Silverlight, etc.). However, in the case of JavaScript, WebSockets cannot deliver raw binary data, because at present JavaScript does not provide support for a raw binary type. Therefore, binary data is ignored if the client is written in Javascript, which in turn limits JavaScript clients to the usage of text-based protocols. Fortunately, other client types such as Adobe Flex and Microsoft Silverlight do provide support for binary types, enabling more than text-based services to reach the browser. As an additional note, some vendors, such as Kaazing, provide libraries to support binary types in JavaScript via base 64 encoding.

Summary

Latency is the mother of interactivity, and in no place is this more apparent than on the Web. Every slip of a millisecond equates to a slower end-user experience which in turn translates into elevated risk that a user's eyes will avert elsewhere. Both AJAX and Comet attempt to obscure latency problems, and certainly address the issue of user-perceived latency. However, WebSockets removes the need to obscure such problems and introduces a solution, one that does not play tricks on the perception of our end-users, but delivers content in real-time with real results.


Sep 5

Google announced on Tuesday the release of the company's much anticipated Chrome Browser. The new browser brings with it a high-performance JIT-based JavaScript engine, V8. After the announcement, Kaazing's development team ran the browser through a battery of our browser certification tests. A expected the browser passed with flying colors, and we are therefore happy to announce the compatiability of Kaazing Enterprise Gateway's JavaScript libraries with Google's Chrome browser.


Jul 16


I recently edited and reviewed author Thomas Powell's last book, "The AJAX Complete Reference." It is an excellent book and I am a bit partial to chapter 10, which outlines several of the Comet transports in use today. To complement the book, Thomas recently published a Website where you can find a free PDF version of chapter 10. In addition, to the chapter you will also find source code for all of the chapter examples.