Building an AJAX-Based Chat: Coding the Receiver Module
(Page 1 of 5 )
In this second part of a three part series of articles, you will learn a lot more material related to building the AJAX-based chat. You will discover how two requester objects fetch or add new messages to the database. Also, you will see the code for a simple login page for registering users that want to access the chat page.
This is it. The stuff you were waiting for! Welcome to part two of the series “Building an AJAX-based chat.” As I hopefully demonstrated in the previous article, building a chat application doesn’t demand that you be a seasoned Java programmer or even an expert developer working with IRC servers. Armed only with a basic knowledge of AJAX and JavaScript, it’s possible to create a simple (but extensible) chat program, which can be easily customized and integrated with existing Web applications, without suffering maintenance headaches.
Before I leap forward, it’s worth a brief look back to remind ourselves of the goal of this series. As you probably remember, in the first tutorial I wrote some of the JavaScript functions that make up the chat application, focusing particularly on the development of the “sender” module. This module is responsible for handling the requests for inserting new messages into the database table, together with updating the display of messages.
Throughout this second article, attention will be turned to writing the functions that compose the “receiver” module of the chat, which also uses a “receiver” requester object for retrieving the list of user messages from the database. In addition, I’ll show a couple of complementary functions, aimed at building the basic layout of the chat itself, as well as a basic login page for registering the nicknames of chat users. Hopefully, by the end of this article, you’ll have a clear idea of how both program modules fit into the whole application, in order to turn it into a fully working web-based chat.
Having established the goals of this tutorial, it’s time to move forward and start coding the chat’s receiver module. Let’s get going!
Next: Retrieving messages from the database: defining the “getChatData()” function >>
More XML Articles
More By Alejandro Gervasio
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|