This was from a while ago but I just wanted to note that it works well, though I do have some issues with when render is then called, since localSetup is no longer used.
Also, why does setupComet take a boxed name parameter? Thanks, Peter On Oct 12, 8:15 am, David Pollak <feeder.of.the.be...@gmail.com> wrote: > On Mon, Oct 12, 2009 at 7:04 AM, Peter Robinett > <pe...@bubblefoundry.com>wrote: > > > > > > > > > Hi all, > > > I have a question about whether it's possible to access RequestVars in > > CometActors (specifically, to access them in localSetup). I believe it > > is, based upon a recent thread about sharing them among snippets[1] > > and an older thread about Actors accessing S[2]. But first, some > > background, as I may be going around this in totally the wrong way and > > would appreciate your thoughts. > > > I am making a dashboard to display a bunch of data that will be coming > > in (near) real-time and I want to use Comet to make sure the user > > always sees the most update-to-date information in their dashboard. I > > have a variety of different aggregate values to display that fall into > > several categories together, so I can group the calculations together. > > I think this sectioning will prove useful in the future, as I can > > imagine wanting to display some but not all of these sections on > > another page. > > > Because the CometActors all will need to know the dashboard to which > > they belong, my thought was to share this Mapper instance via a > > RequestVar. > > You can create messages to be sent to a CometActor upon setup: > > for { > session <- S.session > } session.setupComet("Dashboard", Empty, ABunchOfInfo(sessionInfo)) > > When the "Dashboard" comet actor is created, it will be sent the > ABunchOfInfo message. In this way you can send current request state info > to a CometActor. > > Does this help? > > > > > > > > > I call my snippet like so: > > <lift:Dashboard.display> > > </lift:Dashboard.display> > > > The snippet defines a RequestVar called myDashboard and then returns a > > NodeSeq: > > <div> > > <lift:comet type="DashboardHelper1"> > > </lift:comet> > > // .... > > <lift:comet type="DashboardHelperN"> > > </lift:comet> > > </div> > > > While I can get this all to compile, myDashboard is empty in the > > CometActors. I understand that CometActors basically exist outside of > > the normal request cycle, so would this be the reason why my > > RequestVar is always empty? I was hoping that it would still be in the > > request cycle when localSetup is called, but I can see why that would > > be unrealistic. > > > I just tried using SessionVar instead of a RequestVar and this works. > > However, I'm worried about having to be more careful about emptying > > the SessionVar if requesting a different dashboard than if I would if > > I were using a RequestVar. Is this an unrealistic fear? > > > What do you think is the best way to proceed? > > > Thanks for your help, > > Peter Robinett > > > [1]: > >http://groups.google.com/group/liftweb/browse_thread/thread/5cf4ae2ec... > > [2]: > >http://groups.google.com/group/liftweb/browse_thread/thread/274cfc9d2... > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > Follow me:http://twitter.com/dpp > Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.