<lift:comet type="YourCometClass" name={person_number} />
The optional name attribute allows you to have different comet actor names
(e.g., one per person).  You can retrieve the CometActor's name via the name
method, which returns a Box[String].

In your CometActor, make sure to:

override def lifespan = Full(5 minutes)

This will make the particular CometActor go away if it does not appear on a
page for a 5 minute span.

This lets you have a different CometActor per person, but allows you to
share a single CometActor instance for a given session for a given name
across browser windows/tabs.

I hope this helps and I'd suggest against using SessionVars for passing
setup information to CometActors.

On Thu, Aug 27, 2009 at 7:28 PM, Spencer Uresk <sur...@gmail.com> wrote:

> Hey all,
>
> I'm trying to build an app that takes advantage of the Comet support in
> Lift. This is a simple app that displays all messages from a given person
> and shows new messages as they are added. At first, I struggled with trying
> to pull the request parameter (the url looks like this - /person/1) into my
> CometActor, and then I found a message on the lift board that talked about
> the scope mismatch between the request scope and a CometActor, and
> recommends setting a session variable that the CometActor then reads.
>
> The scope mismatch makes sense to me, so I tried the suggested way of doing
> it, which worked. However, now when I go back to the home page and select
> another person to view messages for, I still see the the old messages. After
> some testing, it appears that CometActors on the same page are not
> re-created if there is one already active. I can't seem to find any method
> that gets called on it when the page is rendered either, and I am not sure
> how to update the state of the CometActor so that it retrieves the proper
> messages.
>
> Is there any documentation or examples for using CometActors in conjunction
> with a request parameter like that? Or is there a better way altogether for
> me to be doing this?
>
> Thank you,
>
> - Spencer
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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

Reply via email to