I have a similar use case and from my experience using a CometActor is
just great for this.

> 1) I assume each page get their own instance of the actor so they can
> hold their own data. Is this correct?

Yes.

> 2) When is a CometActor shutdown? Sometime after the user navigates
> away from page?

CometActors have a time to live. Override
override def lifespan: Box[TimeSpan] = Full(2 minutes)
in your implementation and when the actor doesn't get queried for that
amount of time it receives a shutdown.

> 3) How do I get access to the CometActor instance on the page? I need
> to send a message to it from a function bound to e.g. an ajaxSelect

You need another Actor that dispatches messages to your CometActors.
Say you have ChartCometActor, then implement something like
object ChartManager extends Actor {
...
}
where all your CharCometActors register at creation time. Override
localSetup() for this. Also override localShutdown() to unregister.
Your snippet function then sends a message to the ChartManager who's
responsible for dispatching to all/one actor/s. I use a solution where
I register the CometActors an a session basis, so I can send a message
either to all or just one CometActor.

I have some code available that eases the registration/deregistration
and the sending of messages on a per-session basis.

Hope that helps,
-Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to