Internal Structure

For the curious or the brave, here is an ASCII diagram of how the pieces fit:

+---------+      +---------+     +--------+                         
| Browser | <--> | Adaptor | --> | Mapper |                         
+---------+      +---------+     +--------+                         
                      ^              |                              
                      |              |                              
+---------------------+              |                              
|      +-------------------+---------+----------+          
|      |                   |                    |              
|      V                   V                    V              
|    +---------+         +---------+          +---------+         
|    | Session |         | Session |          | Session |            
|    | Request |         | Request |          | Request |         
|    | Queue   |         | Queue   |          | Queue   |         
|    |    |    |         |    |    |          |    |    |        
|    |    V    |         |    V    |          |    V    |         
|    +---------+         +---------+          +---------+          
|      |                   |                    |             
|      V                   V                    V              
|  +-----+   +------+   +-----+   +------+   +-----+   +------+
|  | Cur |<->| Your |   | Cur |<->| Your |   | Cur |<->| Your |
|  | Req |   | Code |   | Req |   | Code |   | Req |   | Code |
|  +-----+   +------+   +-----+   +------+   +-----+   +------+
|     |                    |                    |
|     V                    V                    V
+-----+--------------------+--------------------+

** "Cur Req" == "Current Request"

Basically, the Adaptor accepts requests from the browser, hands them off to the Mapper, which then queues them into the correct session queue (or creates a new queue).

When Your Code calls $request->next the Current Request overwrites itself with the next item in the queue (or waits until there is one).

Most of the time you will have pretty empty queues -- they are mostly there for safety, in case you have a lot of incoming requests and running sessions.

For further internal development documentation, please see the wiki or email me.