Welcome!

AJAX & REA Authors: John Funnell, Bob Little, Kevin Hoffman, Maureen O'Gara, Onkar Singh

Related Topics: AJAX & REA, Web 2.0

AJAX & REA: Article

Instant Instant Messaging: Just Add Web Sockets

Chat requires full-duplex communication

Futuristic Compatibility Layer
In older browsers, some of the benefits of Web Sockets can be attained through emulation. The Kaazing Enterprise Gateway enables full-duplex communication using several strategies. In the worst-case (the fallback mode) HTTP-based Comet techniques ensure that browsers can communicate bidirectionally with the Kaazing Enterprise Gateway. Even then, the Kaazing client libraries expose the standard Web Socket API, allowing browsers as old as Internet Explorer 5.5 to run applications using Web Sockets.

Whether using emulation or the native Web Socket protocol, applications written against the HTML 5 Web Socket interface can connect through the gateway to TCP servers for real-time messaging, mail, and chat.

Figure 1: Connecting to Google Talk through the Kaazing Enterprise Gateway

XMPP, the Extensible Messaging and Presence Protocol, is a popular protocol used by numerous chat servers and instant messaging networks. The Kaazing XMPP client library uses the Web Socket API in conjunction with the Kaazing Enterprise Gateway to connect to chat servers. Because of the gateway's ability to connect browsers to TCP servers, the chat servers can be unmodified daemons serving XMPP/TCP. This puts chat clients running in the browser on equal footing with desktop chat clients. Clients using an identical protocol on and off the web can connect to the same servers and message freely among themselves.

Online communities have provided mostly static forms of communication such as forums and message boards. This forced users to go out-of-band and use desktop instant messaging clients to carry out live conversations. Users have naturally discovered that IM can be an excellent complement to less immediate communication media. By incorporating web chat into their applications, Facebook and others have provided a more complete user experience inside the browser. Thus far, adding chat to web applications has been difficult.

Web Sockets provide the bidirectional networking chat needs. The concise, point-to-point socket API promotes simple and efficient end-to-end architectures. End-to-end architectures in turn improve scalability and interoperability with desktop chat clients. Best of all, this browser feature can be effectively emulated today on browsers that are nearly a decade old. In all, Web Sockets promise to simplify one of the greatest challenges involved in bringing real-time interactive applications such as chat to the web.

More Stories By Frank Salim

Frank Salim is a polyglot programmer with a keen interest in making life easier for his fellow coders. He leads WebSocket development at Kaazing and is the front man for Kaazing's open source project at kaazing.org. Salim is an open source advocate and a committer in several open source projects. He is a regular author and contributor to the online tech magazine Comet Daily.

Comments (1)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.