Before you start
This tutorial shows you how to use Ajax to create a Web-based IM client. It is for developers who want to learn how to use Ajax to create a functional application and for those who want to learn more about creating instant messaging applications. This tutorial uses the Prototype JavaScript library and a Jabber instant messaging server. You should be familiar with Javascript, HTML, and Java™ programming. If you need a refresher, see the Resources section.
In this tutorial, you create a Web-based instant messaging client using the Prototype Javascript library and a Jabber server. When it's complete, you will be able to choose among users who are on your buddy list and send and receive messages through the Web page to users on traditional IM clients.
In the course of this tutorial, you will learn:
- How to install a complete instant messaging solution
- How to create an instant messaging "bot"
- How to send and receive instant messages using Java code
- How to use the Jabber "roster"
- How to create an auto-updating Ajax-based Web page
All of this gives you an application that turns instant messaging traffic into plain old HTTP, so you won't run into firewall problems.
This tutorial uses the following tools, all of which are set up in the first section:
- Openfire: An instant messaging service to communicate with. Openfire is an open source Jabber server that runs on the Windows® operating system, MacOs, or Linux®.
- Spark: An instant messaging client so you can see what's going on. Spark is an open source Jabber client from the people who bring you Openfire.
- Smack: A way to communicate with the Jabber server. The Smack Java API provides all of the functionality you'll need.
- Prototype: The Prototype JavaScript library that creates and manages the Ajax application.
- Apache Tomcat: A Java Web application server capable of running servlets in order to run this application.
- Eclipse or another Java environment: You build Java applications in this tutorial, so you'll be well served by using a Java IDE such as Eclipse, which lets you develop right on an application server for convenience. Alternatively, download the Java SDK from http://java.sun.com.

