Flash Multiplayer Virtual Worlds
上QQ阅读APP看书,第一时间看更新

Running examples

The easiest way to run the examples is to browse the examples through the embedded web server.

  1. Start the SmartFoxServer if it is not running.
  2. Browse to http://localhost:8080 in the web browser.
  3. It will load the default page of the embedded web server with SmartFoxServer logo.
  4. Click the Install Examples if this is the first time while running the examples.
  5. Click the Browse Examples after the installed examples.
  6. A list of examples appear and you click on them to have some ideas on what SmartFoxServer can basically do.

Loading a simple chat application

Let's test the Simple Chat in Tutorials (AS 3.0) category.

After loading the simple chat, a progress bar appears with the text connecting to server. If the example failed to connect the server, it will freeze at that screen. If it is connected to the server, a login box appears and asks for the login name.

If you failed to see the login box, there is something wrong. It may be a wrong setting in the configuration file, it may be some other issue that failed to start up the SmartFoxServer, or it may be some issue between the testing browser and the server, for example, firewall port blocking.

As we are testing a multiuser application, we can actually launch many instances of the chat applications to test the real-time chatting.

  1. Open several new browsers.
  2. Type in the same address of the chat application in the new browsers. The default URL is http://localhost:8080/Examples/AS3/SmartFoxChat/bin/.
  3. Log in to the chat application with different names for different browsers.
  4. Test the application by sending messages in different browsers. The messages will all appear (almost) at the same time in all browsers.

Let's take a look on how the messages are sent between different chat application clients.

  1. One of the users types in "Hi" in the chat application.
  2. The user clicks the Send button to send the "Hi" message.
  3. The message is sent from the chat application to SmartFoxServer.
  4. SmartFoxServer decodes the message and broadcasts this messages to all connected clients in the same room.
  5. All clients who receive the "Hi" message display it on the chat application.

To further understand what SmartFoxServer can do, we may not only test the simple chat example but also test other examples that are provided by SmartFoxServer.