Home arrow XML arrow Building an AJAX-Based Chat: The Barebones Structure

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.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 43
November 08, 2005
  1. · Building an AJAX-Based Chat: The Barebones Structure
  2. · Defining the application’s core logic: working with requester objects
  3. · Sending chat messages: defining the “sendMessage()” function
  4. · Checking for the progress of sender requests: defining the “senderStatusChecker()” function
  5. · Updating the display of messages: coding the “displayChatData()” function

print this article

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.

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.

blog comments powered by Disqus

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials