- Project Overview
- Comparing Technologies
- IRC Network Basics
- Fitting the Application into the Network
- Interfacing the Network
- Administration and Security
- Implementation
- Summary
Fitting the Application into the Network
If you came up with a plan to develop your own server in PHP (or something similar), rethink a bit. You might have gotten a bit confused with the idea that implementing a chat server means implementing a network server. This is indeed something we wanted to lead you to, but don't want you to do, as this is simply unnecessarythere's already a well-written server software available for all systems. So how about using one of the existing servers and representing our server to the network as a client? The only thing we'd have to do is to add another layer of abstraction to the network, as shown in Figure 3.4.
Figure 3.4. phpChat as an abstraction layer to the server.
The Web server will run the PHP chat server. For each client connection it accepts, it will create a client connection to the IRC server. This way, we can make sure that all data we get for this client is meant only for this clientand nobody else. Each chat process will carry a single user, and doesn't have to worry about other users. User coordination, traffic control, and so on can be done by the IRC server, for which we'll simply take one of the freely available servers.
This technique also has the advantage that this chat server application can be used as a safe gateway to IRC networks (see Figure 3.5). A lot of corporate and private networks are behind firewalls that filter IRC ports. Since this chat is only communicating via HTTP to its clients (which is not filtered), only the chat server itself needs an open connection to an IRC server.
Therefore, the only thing we're going to do is to implement the client software that would otherwise be required on the user's side on our Web server. IRC knows all the commands that are required to set up a powerful chat, and the networking issues can all be solved by using standard "off the shelf" server software that's already available. Thus, if our interface supports all features of IRC in a convenient way, we're done with our work.
Figure 3.5. phpChat as a safe IRC gateway.