WWW FAQs: How do I add a chat room to my website?

2006-02-11: There are two basic kinds of chat on websites: live support, and user-to-user chat. If your goal is to provide live support to your website visitors, see the article how can I provide live support chat on my website? The rest of this article is concerned with user-to-user chat.

Like guestbooks, chat rooms require more than just a pretty form to type your comments into. There must be something listening on the web server to accept the user's comments and do something with them. That will usually be a PHP, Perl/CGI or ASP script.

There are many chat room packages you can install on any good hosting account that supports PHP or one of the other server-side programming languages. In particular, a free, open-source PHP web chat server is available from phpopenchat.org. phpopenchat can be integrated with the popular phpBB forum software to provide live chat for users who have already logged on to their forum accounts. phpopenchat requires PHP and a database, which you probably have if your hosting account allows PHP.

Important Warning: unsupervised chat rooms may be abused for very unpleasant purposes or used to discuss illegal activities. I do not recommend running chat rooms which are open to the general public without a moderator watching for inappropriate behavior. If you don't want your chat server used for purposes you never intended, you should restrict its use to users who have signed up for accounts that you can revoke. Unmoderated chat for the general public is a need already well-met by services like AIM.
There are other ways to create chat rooms. Jabber is a free, open source chat server solution with power to spare, but it requires that users have compatible chat client software. That means users might need to install software on their ccomputers, although the list of compatible programs does include the popular Trillian program.

Java is another valid approach. Some chat servers use a client written as a Java applet. These can work well and often provide features missing from "plain vanilla web page" chat rooms, like avatars and a 3D environment. One of the best is Visual Chat. But before you run out and install Visual Chat, consider that 3D environments for chat aren't really all that exciting to use, and not everyone has the Java plug-in correctly installed on their computer. Visual Chat also requires a Java-based server program. Most hosting services won't give you the privilege of running Java applications on your server without paying an extra fee. So Visual Chat is usually not the simplest solution.

Those who are using free hosting, or who are unwilling or unable to learn to install any software, have the option of using one of the services that provide free chat rooms for websites. The best of these services will insert advertisements into your chat room's display. The worst of them will also install spyware on the user's computer, which can make your website very unpopular indeed. One of the best legitimate free chat room services is Freechat from chat-forum.com, which is supported by banner advertising in the chat window. I recommend installing phpopenchat on your website instead. Those who don't want to install software and have a budget for such things may wish to consider freechat's "gold chat room" service, which is not free but does not display ads.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!