Chapter 3: Creating a Chat Room Application


Download CD Content

The Jabber protocol helps you develop chat room applications hosted on the Jabber server. End users can join a chat room to send and receive messages and view a list of other end users of that chat room.

This chapter describes how to develop the Chat Room application by using the Jabber protocol. The application allows end users to create or join a chat room and send messages to other end users of an active chat room.

Architecture of the Chat Room Application

The Chat Room application uses the following files:

  • LoginGUI.java: Creates the Login window for the Chat Room application to allow end users to establish a connection with the Jabber server. This file allows end users to login as existing end users or create a new account.

  • MainGUI.java: Allows end users to view a list of existing chat rooms and select any chat room from the given list.

  • ChatRoom.java: Allows end users to enter a chat room by specifying a chat room name and a user name to participate in the group chat.

  • RoomInformation.java: Allows end users to create a chat room by specifying a chat room name and a user name to initiate the group chat.

  • GroupChat.java: Allows end users to participate in a group chat.

  • SocketOpener.java: Opens a socket to send and receive messages through the Jabber server.

Figure 3-1 shows the architecture of the Chat Room application:

click to expand: this figure shows the files that the chat room application uses and the sequence in which the application uses them.
Figure 3-1: Architecture of the Chat Room Application

The LoginGUI.java file creates the Login window that contains various labels, text boxes, and the Submit button. This file allows end users to login as existing users or register for a new account.

When end users enter login information and click the Submit button on the Login window, the LoginGUI.java file calls the MainGUI.java file. The MainGUI.java file allows end users to create a chat room or join an existing chat room. The MainGUI.java file allows end users to select a chat room from the list of existing chat rooms provided by the user interface of the Chat Room application.

When end users select File->Create New Chat Room on the user interface of the Chat Room application, the MainGUI.java file calls the RoomInformation.java file to create a chat room. The RoomInformation.java file allows end users to specify a name for the chat room and a user name for the end user.

When end users select File->Go to Chat Room on the user interface of the Chat Room application, the MainGUI.java file calls the ChatRoom.java file to enter an existing chat room. The ChatRoom.java file allows end users to specify the name of the chat room and the user name to join the existing chat room.

When end users select any chat room from the list of existing chat rooms, the MainGUI.java file calls the SocketOpener.java file. The SocketOpener.java file opens the socket to send and receive messages between two end users. The SocketOpener.java file calls the GroupChat.java file to allow end users to participate in a group chat.




Developing Applications Using Jabber
Developing Applications Using Jabber
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 68

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net