eComet communicates with web browsers via a gateway. To use eComet, you must configure one Type 4 gateway on your Comet system. To do so, add the following statement to your INI configuration file:
GATEWAY = 4,0;
The "4" stands for "Type 4 gateway" and the "0" means that there is no "sub-type."
Note: Your system may have other gateway devices. If so, just add the XAP gateway to your existing configuration; eComet automatically determines which gateway device number to use (e.g., G00, G01, G02).
Configure a Comet directory named XAP. All of your eComet object programs must be located in this directory. This provides a measure of security for your eComet system.
When a web browser runs an eComet program, Comet looks for that program only in the XAP directory, and does not look in any other Comet directory.
Of course, you can have data files in other Comet directories, but your web applications must be in the XAP directory.
Note: If you have more than 50 directories configured, make sure that the XAP directory is configured in the first 50. If it isn't, eComet will not work (as the program running in a background partition does not access directories beyond the first 50 configured).
eComet creates temporary files in a Comet directory named COS. Make sure that your eComet system has a COS directory configured.
Note: If you have more than 50 directories configured, make sure that the COS directory is configured in the first 50. If it isn't, eComet will not work (as the program running in a background partition does not access directories beyond the first 50 configured).
This directory is not a Comet directory, but it is required for temporary files that are created by eComet.
Every time a web browser sends a request to your eComet system, Comet processes the request and activates your Internet Basic program in a background partition. You'll need to configure enough background partitions to handle the expected number of simultaneous requests being made by web browsers.
Here's a recommended configuration for an eComet system:
1 foreground partition (console session) 99 background partitions (for XAP programs)
This recommended configuration supports up to 99 simultaneous requests being made by web browsers. By their very nature, XAP programs process data and produce results quickly, so don't expect these background partitions to be tied up for great lengths of time. Once the XAP program has sent a return page back to the web browser, the program terminates itself and frees up the background partition for another task.
Please notice that there are no CometAnywhere sessions is this recommended configuration. Having CometAnywhere sessions on the same machine as eComet could result in a security lapse, as a CometAnywhere user could access programs other than those on the XAP directory. In the worst case, a CometAnywhere user with access to the Comet Editor and Internet Basic compiler would be able to add an unauthorized object program to the XAP directory.
When you run XAPMON, you must specify which port it will use for communications. If you are running only eComet on your system, and not running another web server on the same machine, use port 80, the default port number that web browsers use.
If you are running another web browser on your eComet system, use another port number. For example, on signature.net, we're running O'Reilly's Web Server on port 80 and eComet on port 8080.
This means that our server is "listening" for web page requests on port 80 (example: http://www.signature.net) and eComet requests on port 8080 (example: http://comet.signature.net:8080/xap/hello).
Our recommendation is to use port 80 and don't run another web server on your eComet system.
When XAPMON starts, it uses a default port number of 80. To specify a different port number you can run XAPMON with a command file. The default command file name is #XAP. This is a Comet Editor file.
To use a command file with XAPMON, create #XAP and add the following lines to it:
CLOSE LISTEN port-number
The CLOSE command tells Comet to stop listening on the XAP gateway (in effect, resetting the gateway). The LISTEN command tells Comet to start listening via the XAP gateway, using the specified port.
For example, if you want your eComet system to listen on port 8080, add these lines to the #XAP file:
CLOSE LISTEN 8080
The #XAP command file may also contain a LOGFILE command. If this command is present, Comet will write a log file when XAPMON is started. This log file will contain nothing (indicating a problem-free startup) or will contain startup error messages.
Here is the syntax:
LOGFILE log-file-name
Note: The log file is a Comet text file that is created on your current directory (the directory from which you loaded Comet).
If the #XAP file is not found, XAPMON attempts to open a command file named #CGI.
If the #CGI file is not found, XAPMON uses the following defaults:
Your Internet Basic programs may use LUN 10 through LUN 49.