* You must have a web server with CGI support and Ruby installed, and at least one port open for clients

* You must have a web browser supporting Javascript DOM to use the dynamic client

How to install and run the server

1. Place statemachine.cgi, client.html, and client.js in a directory accessible by the web server where CGI scripts can be run

2. Launch runserver.rb (and daemon.rb if you wish to use the dynamic client) and allow them to continue running on the server

3. To use the Javascript client, browse to client.html; to use another XMPP client, connect to server:9988 . Ports may be changed in server.rb.

Overall system architecture

Server.rb implements an XMPP server mostly compatible with the following standards:

* RFC3920bis, except for TLS, dialback, server-to-server connections, and complete compliance regarding resource binding

* RFC3921bis, session establishment and messages only

* XEP-0045, basic groupchat and room history only

* XEP-0077, registration only

This is done in two classes. XMPPServer provides static HTML-generation methods and a loop which accepts connections on TCP port 9988. An XMPPListener instance handles incoming stanzas from a single client in an event-driven fashion. It builds a tag stack until it hits an "interesting" tag_end, at which point it pops off the tags it needs to work with and processes the block. It also maintains information about the state in which the client currently lies. When an XMPPListener needs to modify global information (such as the list of active clients) it acquires a central mutex in the XMPPServer class.

How to add a new feature

1. Write XML-generation functions for your features in XMPPServer

2. Write event handlers for your feature in XMPPListener

3. Modify the lines in XMPPListener which send the server's feature set to the client, advertising support for your new functionality

Coding guide

* Any time access to a global variable in XMPPServer is needed, the XMPPListener must acquire server.mutex

* Each XMPPListener may only communicate with its own client; to send a message to another client, find the other XMPPListener object via server.clients and then call its write function

-- BryanJacobs - 23 Apr 2009

This topic: Main > TWikiUsers > ChenDing > CS290Spring09 > CS290Spring09ProjectGroupB > CS290Spring09ProjectGroupBDevMan
Topic revision: r1 - 2009-04-23 - BryanJacobs
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback