Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Latest commit 5a7eb8a Probed More Updates
Failed to load latest commit information.
Character Equipment Update
Database More Updates
Game More Updates
Install More Updates
Log More Updates
User More Updates
pages More Updates
Cache.njs Inventory Start/Logging Readme Update
index.html UI Changed to JxLib/Requirejs
mootools-core-1.4.2-server.njs Item/Tile/Character updates
rpgApp.njs More Updates

Server Side Stuff

All requests are processed through rpgApp.njs


Starts the Node.js server listening on the specified port. In the case of IISNode we need to use process.env.PORT



  • RPG.App

Request Handling

All requests begin at onRequest and are handled in the following order:

  1. Attach an event handler to the request object to start receiving incoming data from post requests. Upon receiving all the data the variable will be populated with this data.
  2. Determine who the user is by looking at their cookies (create a user if not found) continue on to step 2 when a determination has been made.
  3. Check to see if an XmlHttpRequest is being made.
    1. false : No XHR means initial load - Send the client the /server/index.html template. End Request
    2. true : pass control to routeXHR
  4. routeXHR uses the querystring parameter a as the 'Action' to be performed. a can contain a hashtag which signifies the /server/pages/ to use
    1. if a contains a ? in it's value, everything after the ? (seperated by ::) is converted into a querystring an appended to the current querystring
  5. Attempt to handle the request using the /common/pages.js object.
    1. if a suitable handler is found then control is passed to the handler.
  6. Attempt to handle the request in other ways
    1. if a suitable handler is found then control is passed to the handler.
  7. return an error if no suitable handler was found.

Response Handling

All responses should go through onRequestComplete. The onRequestComplete function is attached to each response object so the callback can occur anywhere the response object goes.

To end a request simply use: response.onResponseComplete(response,results)

if the result is an error object: eg { error : errorStuff } then onRequestComplete will use a 500 header instead of a 200 header.

Something went wrong with that request. Please try again.