Building an AJAX-Based Chat: The Barebones Structure
Chat programs are common on the web these days. HTTP-based versions were often built as Java applets, but today, developers have a wider range of options when building chat programs. This article gets you started with building one that uses AJAX as the workhorse for sending out http requests without the need for page reloading.
Building an AJAX-Based Chat: The Barebones Structure (Page 1 of 5 )
You’ve been seen it hundreds, if not thousands of times before. You’ve surfing the Web, looking for a website that offers the possibility of meeting people and talking in real time, and certainly many times during your exhaustive search, you’ve been confronted with the user interface of an IRC (Internet Relay Chat) application, most of the time developed in Java.
Let’s be honest, people are made to talk. And that’s precisely the reason for the massive proliferation of software aimed at providing real time communication between users. Instant messaging programs rule all the way, when it comes to being in touch with other people. However, for fully web-based applications, things have been a little different. As I mentioned before, http-based chat programs were most of the time built as old Java applets, because of their relative ease to be included within web pages, simply by fetching the appropriate Java files and wrapping them into deprecated <applet> tags.
Fortunately, on today’s Web, developers have a wider range of options for developing chat applications, without the need to be a seasoned Java programmer. Server-side scripting languages such as PHP or ASP make it fairly easy to build chatters with a decent level of responsiveness. Of course, the major drawback with using these languages in developing pseudo real-time communication programs was the natural inability to make http requests in the background, without dealing with page reloads. As a result, most of these applications involved the use of refresh meta tags for updating the contents of the chat.
Have I caught your curiosity about building an AJAX-based chat? Fine, let’s get started.