This server is useful for verifying that EventWeb is installed and working
properly; And it also provides a relatively simple example of how EventWeb
works.
If port 80 is available on your machine, running the server is very simple.
If you can't use port 80, see Using an alternate port.
Start the server
- Open a terminal (command prompt) window.
- Go to the release package bin directory.
- Run BcTestSrvr.bat (windows),
or BcTestSrvr.sh (linux/unix).
You will get a timestamped message indicating the server is starting.
When the service is ready you'll get another timestamped message with the
service location, (port & path), followed by a dashed line.
Below the line a one line message will be printed each time a client
connects.
Access the server
- Connect to the server with your web browser.
Use http://hostname, where hostname is the host name
or IP address of the machine running BcTestSrvr.
- Navigate to BcTester.html.
Choose Demos, then Backchannel Tester.
(You may get a security warning because the eventweb applet is unsigned.
If you do, you will have to give permission for the applet to run.)
Notice the square in the upper right corner of the tester page header.
This is the applet that communicates with the server. It displays no
content, but it's color indicates the applet's state:
Yellow - Running but not connected.
Green - Connected.
Red - An error has occurred.
Orange - Indicates a warning.
Any other color indicates the applet is not loaded yet.
(If there are two colors, the bottom color is a previous
transitional state.)
In the lower left corner of the page header is a line with information
about the applet, (obtained by calling it's getAppletInfo() method).
When the page first loads this line just says "Applet Info".
In normal use, EventWeb is very fast. However, in this situation it will
be slower. Once the applet is loaded in the browser's cache, it
will run a lot faster. We always use the same applet, so this is a
one time operation for each host.
Before doing anything else, you need to wait for the applet info
line to fill in with something like:
TvIoWwgt Version x.x.x, Steve Thompson
Depending on the speed of your system, this could be anything from
instantaneous to a few seconds.
Once you have the info line, the page is fully loaded and ready to connect
to the server. (In production applications we have the applet connect
automatically, here we're doing things manually.)
The Backchannel Tester web page.
At this point, the applet light in the upper right should be yellow.
There are a number of beveled blue squares with labels on the page.
These are push buttons.
The text field labeled Full URL is the URL for the server and must point to
the location BcTestSrvr is listening at. If you are following this
with no changes, it will be http://hostname:80/EvwTest/BcTest,
and the server will be listening at that location.
The buttons and fields above the Full URL field are provided as a
convenience for editing it. Do this if you have changed the port or path
the server is listening at.
Directly below the Full URL field are buttons for connecting and
disconnecting from the server.
A wide blue line separates the connection area from the testing area.
The testing area has fields for displaying:
the connection status,
the last timestamp received from the server,
a test count field,
the last test message received from the server,
and a field for status messages.
Below that are the test buttons.
Connect to the server
- Click the Connect button.
The status light will turn green, and the connection status will
change from "Not connected" to
"Connected to SimpleBcTestSrvc Instance x".
The SimpleBcTestSrvc used by BcTestSrvr doesn't implement the test counter,
and just returns n/a for the test count. The test count field will fill in
with n/a.
Again, the first time you do this, the process could be anything from
instantaneous to a few seconds. The reasons are similar to those discussed
above. If the connection is slow, you will get status messages. If it
fails, (wrong port, server not running, etc.),
the status light will turn red.
If the status light is green, you are ready to test the backchannel.
- Click the Get Timestamp button.
The current time will appear in the Last Timestamp field.
Clicking the button sent a Timestamp request to the server,
and it responded with the current time (on the server,
in milliseconds). The JavaScript in the web page converted that
to the local time format and displayed it.
- Click the Start Test button.
Backchannel test message 1 will appear in the Last Test Message field,
followed by a new test message every 2 seconds. A whole new message is
displayed, but the only difference you see is the message number.
This time we sent a StartTest message, and the server began sending
messages at two second intervals.
- Click the Get Timestamp button again.
The Last Timestamp field will be updated.
Notice that we can do this without disrupting the test messages.
- Click the Stop Test button.
The server stops sending test messages.
- Click the Get Timestamp button again.
The Last Timestamp field will be updated.
Timestamps are independent of test messages. We can get a
timestamp any time we are connected.
- Click the Start Test button again.
Notice that the test messages resume where they left off.
The server is maintaining state for this client.
- Click the Disconnect button.
The status light turns yellow, and we get a Connection closed
status message.
(It's ok to disconnect while the test is running, the server
detects the disconnect and cleans up.)
- Click the Connect button again.
Even if the connection was slow before it should be nearly
instantaneous now.
- Click the Start Test button.
The test messages restart at 1.
This is a new session.
- Click the Stop Service button.
The status light turns yellow and orange, and we get a "Connection
closed by server" status message; And the server exits with a
"Server closing per client request" message.
We sent a service stop request to the server and it stopped.
This only works with BcTestSrvr, if we were talking with
a full server it would ignore the message.
- Click the Connect button again.
The status light turns red and we get a "Server not available"
message
We expected this, since the server is not running.
More Tests
- Try opening two Backchannel Tester pages, and notice that their
test message sequences are independent. A separate context is
maintained for each client.
The EventWeb architecture supports two kinds of service:
one that maintains a separate context for each client, and one where
every client connects to the same service instance. In that case each
client has it's own connection, and requests and responses are
independent, but they both access the same underlying data.
- Try running BcTestSrvr with the -iotrace option. You will be
able to see the messages going back and forth to the client.
You can see all the command line options by running
BcTestSrvr.xxx -help (xxx is bat or sh depending on
whether you are on Windows or Unix/Linux.)
- If you've been running the web browser on the same machine as the
server, try connecting from a different host. It should make no
difference where you connect from.
This set of tests is not very exciting, but it demonstrates EventWeb's
asynchronous, bi-directional communication, and use of
the result to update the HTML on a web page. This ability is the foundation
of the EventWeb architecture.