home   articles   archive   forum   masthead  
Published at 14.11.1999
Author: Ronny Ziegler
Translator: Benny Lyons
Languages: de nl
Printer printer-version
Support Us!
 

Chat for your homepage

Chat Would you like to provide visitors to your web site the opportunity of chatting to one another? There are several possibilities available of doing this by CGI and/or SQL.
The system administrator will indeed be grateful ...


How Do I Chat Correctly?

Chatting via a CGI script and SQL data bank is possible, but it is hardly to be recommended (even though one comes across sites which employ this method.) The load on the computer is so high that there is little residual resources left for other jobs on the system.
For this reason, a client/server solution is the more preferred way, even though this has the distinct disadvantage of requiring the visitor to the site to download additional software (either in the form of a Java applet or even a chatclient for a particular operating system.) This might appear at a first glance to be somewhat cumbersome, however, this is more than compensated by the fact that hardly any CGI script can come close to providing the comfort offered by a real chat client.
For this reason, we only have a server/client based chat programme.

SpanielChat

SpanielChat has been entirely written in Java---both the client and the server---and this has been implemented as an applet.
Although the system load on the java server is low while the server is running, the complete Java Virtual Machine has to be started when java programmes are started, this requires significantly more resources.
Installing SpanielChat is easy. Unpack the programme and copy to a subdirectory in the web server.
If the directory is listed in $PATH, then

  >> java SpanielChatServer& 
  
will suffice to start the server. If 'Client.html', which is supplied with the package, is selected in the browser; then the connection to the server is automatically established and the client is opened in another window. This enables the user to continue surfing in the browser in the background. No IP or port number needs to be configured (as long as the standard port is used.) Installing a package can hardly be made any easier.

One of the more notable characteristics of the chat client is the ease in which it can be used. Various topic related chat rooms are available which can also be closed, thus enabling the user to avoid unwanted guests. SpanielChatClient may be started in the appletviewer, which is a part of the JDK (Java Development Kit), which allows the user to chat without having to start the browser.

  >> appletviewer http://www.server.de/spanielchat/client.html&
  
Hence, the client can be called and used just like any other programme.
The programme may be found at http://www.searchspaniel.com/chatserver.html.

Javachat

Javachat is purely a chat server and, as the name suggests, it has been written in Java. A special client is not required to chat on the server, rather, any old telnet programme is all that is required to connect up to the server.
Simply typing

  >> telnet my.server.de 6666
  
is enough to connect to the server (Javachat uses the 6666 port as default.)
However using the programme in the text command mode is not particularly intuitive which has lead to the development of clients for Javachat that have a graphical user interface.
One such client is Chatapplet which runs as an applet in any Java compliant browser. (The new version has overcome a number of difficulties over a considerable length of time with MS-IE to be, once again, compatible with the standard browsers.)
The applet can be easily built into the users homepage and can also be used, just like SpanielChat, with Appletviewer.

Furthermore, two servers have recently become available to Linux in addition to the Java server. Both servers have been written in C and, consequently, place significantly less demands on system resources.
The Melange Chat Server and Naken Chat are completely compatible with Javachat and, as opposed to Javachat, have been written in C.
The essence of Naken Chat, Javachat and Melange's popularity and widespread use is both their ease in which they can be installed and the numerous options available in configuring the programmes to suit the needs of the user.
Whereas the Java server should only be started when it is needed, the Naken Chat server hardly places any load on the computer when it is started at boot up time. In order to do this, a shell script has to be added to the /sbin/init.d subdirectory, for example:

Skript /sbin/init.d/nakenchat (für SuSE 6.0)
   #! /bin/sh
   # /sbin/init.d/nakenchat
  
   . /etc/rc.config
  
  
   # The echo return value for success (defined in /etc/rc.config).
   return=$rc_done
   case "$1" in
      start)
          echo -n "Starting service nakenchat"
          ## Start daemon with startproc(8). If this fails
          ## the echo return value is set appropriate.
          startproc /path/to/nakenchat1.0x/nakenchat -f /path/to/nakenchat1.0x || return=$rc_failed
          echo -e "$return"
          ;;
      stop)
          echo -n "Shutting down service nakenchat"
          ## Stop daemon with killproc(8) and if this fails
          ## set echo the echo return value.
          killproc -TERM /path/to/nakenchat1.0x/nakenchat || return=$rc_failed
          echo -e "$return"
          ;;
      restart)
          ## If first returns OK call the second, if first or
          ## second command fails, set echo return value.
          $0 stop  &&  $0 start  ||  return=$rc_failed
          ;;
      status)
          echo -n "Checking for service nakenchat: "
          ## Check status with checkproc(8), if process is running
          ## checkproc will return with exit status 0.
          checkproc /path/to/nakenchat1.0x/nakenchat && echo OK || echo No process
          ;;
      *)
          echo "Usage: $0 {start|stop|status|restart}"
          exit 1
          ;;
   esac
  
   # Inform the caller not only verbosely and set an exit status.
   test "$return" = "$rc_done" || exit 1
   exit 0
  

Other distributions will probably require a simpler shell script.

Skript /sbin/init.d/nakenchat
   #! /bin/sh
   case "$1" in
      start)
          echo -n "Starting service nakenchat"
  	/path/to/nakenchat1.0x/nakenchat -f /path/to/nakenchat1.0x
          ;;
      stop)
          echo -n "Shutting down service nakenchat"
          killname /path/to/nakenchat1.0x/nakenchat
          ;;
      restart)
          $0 stop  &&  $0 start  
          ;;
      *)
          echo "Usage: $0 {start|stop|restart}"
          exit 1
          ;;
   esac
   exit 0
  

Moreover, two symbolic links S99nakenchat and K99nakenchat in /sbin/init.d/rc2.d and rc3.d respectively, are required to the above script. (The numbers indicate the position at which the script is called. This has to occur after any network support services have being started.)

OpenNaken

In the meantime, there is a substitute server available for Javachat and a TCL/TK version is available for the client.
This is called OpenNaken, and it runs under Linux just as easily as it does so under Windows, which is due to the availability of a TCL/TK toolkit for the Windows operating system.
Unfortunately the widespread use of TCL/TK enjoyed under Linux has not experienced quit the same popularity under the Windows operating system. Consequently, a visitor, who is using Windows, to the HTML page will have to download, on the one hand, Open Naken, and, on the other hand, the entire TCL/TK package.

Open Naken Screenshot

It is on account of this that OpenNaken not the recommended programme is to be used in a homepage; here, the Java applet is more suitable, but for the user who would like to chat on a frequent basis---or, if the entire LAN communicates via the Nakenchat server---OpenNaken is to be recommended because it is fast and user friendly.

Links
   Homepage SpanielChat: http://www.searchspaniel.com/chatserver.html
   Homepage Javachat, Naken Chat und chatapplet: http://home.i1.net/~naken/nakenchat/
   Homepage Melange chat server: http://melange.terminal.at/
   Homepage OpenNaken: http://Daemon.netfirms.com




Talkback Area




Enter Own Comment