Example Chat Screen.
It is a single script to keep installation and maintenance as simple as possible. The script manages a single file, 'chatter.txt' which contains the conversation history.
Multiple users can login with usernames and chat amongst themselves. Only a single conversation is managed; this script does not manage multiple conversations or 'channels'; there is just a single conversation many people can join.
A fixed width font is used throughout so that code pastes and indenting maintains alignment. (It's a design goal to allow programmers to post code to each other) There is a special "Send Code" button which appends code unmolested; indenting is preserved, and chat prompts won't be mixed in.
The reason(s) I wrote this thing and prefer it to most of the chat software out there, including Messenger, iphone Chat, Skype Chat, etc:
$G::selfurl = "http://yourserver.com/cgi-bin/chatter.cgi"; # url to script on your serve $G::chatfile = "/some/dir/chatter.txt"; # unix path to chatfile (file perms must be rw-rw-rw-)
echo > /some/dir/chatter.txt && chmod a+rw /some/dir/chatter.txt
The chat file's contents (if any) is fetched and displayed in the upper chat window's history. The browser then sets a 3 second javascript timer to poll the file size of this file to see if the size has changed, and if so, updates the changes to the browser.
Whenever someone enters new text and hit's "Send", this posts a form in the lower frame, appending the new text in a single atomic operation to the chatter.txt file. Within a few seconds, all the participant browsers will see the chatter.txt file's size has changed, and update with the new text.
The default polling speed is 3 seconds. This speed can be changed by modifying the refresh_msecs global at the top of the script. Faster polling makes updates quicker, but puts more load on the network and server.
If you want to password protect the script, use .htaccess/.htpasswd files to manage access via your webserver.
Since it never zeroes itself out, old conversations remain.
If you want to clear the chat, can do it by using the "Archive" button
(available only to the moderator's username -- see $G::moderator in the script)
or by emptying the file using, e.g.
echo > /some/dir/chatter.txt