#181 WebSession

brian Fri 21 Mar 2008

This is the API I'm thinking about:

@serializable
class WebSession
{
  readonly Str id
   Obj get(Str name) { return map[name] }
   Void set(Str name, Obj val) { map[name] = val }
   readonly Str:Obj map := Str:Obj[:]

} 

Plus there is a new WebReq.session method.

Do you think we need anything else? Some APIs have isNew (is that useful?). The Java API has creation/lastAccess time - although that adds overhead b/c we have to resolve the session even if not used.

Of course the trick here is how to implement - cleaning up from mem ns would require efficient query mechanism. In this case I'm thinking that web sessions are standardized in web (we never rely on native web server implementation). The I'm thinking is to have a background that that manages the sessions.

brian Fri 21 Mar 2008

The WebSession API is checked in as described. It seems pretty elegant.

I implemented using a background thread - Thread.sendSync messages which I use seems pretty fast - about 0.7ms for a round trip.

Although doing this work, I discovered I think we need:

  1. some way to "attach" threads together for start/stop
  2. some way to create timers (probably which post back to the queue)

Login or Signup to reply.