I have the following Comet actor:
class ChatComet extends CometActor with CometListener {
private var messages: List[ChatItem] = Nil
def registerWith = ChatServer
override def lowPriority = {
case v: List[ChatItem] =>
messages = v;
reRender()
}
def render = {
"li *" #> messages.map(message =>
".name *" #> message.name &
".text *" #> message.value
)
}
Which distributes messages around various rooms, what I don’t have is a way to limit which messages end up where, so a message from RoomA ends up in RoomA not in RoomB.
I’ve heard you can initialize comet actors with some kind of message which in my case could serve as the room id.
Is this the right way of doing things? If so how would I go about doing it?
Thanks in advance for any help, much appreciated 🙂
In the template, name the comet actor, like so:
In your CometActor, then match on the name, like so:
Now, you probably don’t have explicit names like “roomA” but you can keep a list of your room names, and then simply match against them.