Building an AJAX-Based Chat: The Barebones Structure (Page 1 of 5 )
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.
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.
As you may have guessed, in this article I’ll attempt to develop a chat application by using AJAX as the workhorse for sending out http requests without involving page reloading. Through this first tutorial, I’ll draw the general guidelines for building this application, along with writing down some of the JavaScript functions that will compose the complete program. Hopefully, by the end of this series, you will have a pretty clear idea of how the chat works, and certainly of the possible improvements that can be introduced into the original application.
Have I caught your curiosity about building an AJAX-based chat? Fine, let’s get started.
Next: Defining the application’s core logic: working with requester objects >>
More XML Articles
More By Alejandro Gervasio
|
| · | | · | | · | | · | | · | | · | | · | | · | | · | | · | | · | | · | | · | | | | |
|