LiftSession.sendCometActorMessage with an unknown name

73 views
Skip to first unread message

Antonio Salazar Cardozo

unread,
Nov 1, 2011, 11:38:16 AM11/1/11
to lif...@googlegroups.com
Hello all,
I just ran into a use case where I'm generating comet actors with a randomized name (so they are tab-specific), but want to send any and all of them, including any created this request/response cycle, a message to join them to a central coordinating actor when rendering a particular page. LiftSession.sendCometActorMessage was a godsend for this, until I started giving the actors randomized names. Could we introduce a way to address actors with *any* name, in addition to actors with *no* name (what happens when passing Empty for the name parameter in sendCometActorMessage now), in sendCometActorMessage?

For now, we can hack it using a (Transient)RequestVar that sets up the proper name whenever either the comet actor or the sendCometActorMessage method accesses it, but it seems like having it supported in sendCometActorMessage directly would be handy dandy.
Thanks!
Antonio

David Pollak

unread,
Nov 2, 2011, 3:35:38 PM11/2/11
to lif...@googlegroups.com

On Tuesday, November 1, 2011 at 8:38 AM, Antonio Salazar Cardozo wrote:

Hello all,
I just ran into a use case where I'm generating comet actors with a randomized name (so they are tab-specific), but want to send any and all of them, including any created this request/response cycle, a message to join them to a central coordinating actor when rendering a particular page. LiftSession.sendCometActorMessage was a godsend for this, until I started giving the actors randomized names. Could we introduce a way to address actors with *any* name, in addition to actors with *no* name (what happens when passing Empty for the name parameter in sendCometActorMessage now), in sendCometActorMessage?

You can get a list of all comet actors of a given type with LiftSession.findComet("MyChat")

Will that get you what you need or do you want another API call?  If so, please open a ticket.
 

For now, we can hack it using a (Transient)RequestVar that sets up the proper name whenever either the comet actor or the sendCometActorMessage method accesses it, but it seems like having it supported in sendCometActorMessage directly would be handy dandy.
Thanks!
Antonio

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

Antonio Salazar Cardozo

unread,
Nov 3, 2011, 12:30:10 AM11/3/11
to lif...@googlegroups.com
I'll open a ticket, mostly because the advantageous aspect of sendCometActorMessage is that it also works for an actor that is created during the current request cycle—so findComet will let me send it to all existing ones, sendCometActorMessage will currently let me send it to an existing or to-be-created actor whose name I know, I basically want to be able to send it to all existing ones + one that may be created this request cycle.
Thanks!
Antonio

Antonio Salazar Cardozo

unread,
Nov 3, 2011, 3:10:31 PM11/3/11
to lif...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages