What is the proper way to apply a custom filter to a comet chat

69 views
Skip to first unread message

Oleg G.

unread,
Oct 13, 2010, 6:48:32 AM10/13/10
to Lift
Hi all,

I'm trying to add a filter to a comet chat, i have different kind of
messages, everything else is based on the lift's comet chat example.
So there are some checkboxes to exclude certain kind of messages, all
is working but currently i'm updating all listeners of the ChatServer
every time someone changes their filter. I've looked through API docs
and source code and couldn't figure out a good way to only send update
to one session.

Any hints?

David Pollak

unread,
Oct 13, 2010, 1:39:52 PM10/13/10
to lif...@googlegroups.com
On Wed, Oct 13, 2010 at 3:48 AM, Oleg G. <ojo...@gmail.com> wrote:
Hi all,

I'm trying to add a filter to a comet chat, i have different kind of
messages, everything else is based on the lift's comet chat example.

You might try looking at the code that I wrote for the CUFP Lift tutorial... it gives you multiple chat rooms... while this isn't filtering, it'll give you an idea of how to do things differently on a per user basis.
 
So there are some checkboxes to exclude certain kind of messages, all
is working but currently i'm updating all listeners of the ChatServer
every time someone changes their filter. I've looked through API docs
and source code and couldn't figure out a good way to only send update
to one session.

Any hints?

Personally, I'd do all the filtering in the CometActor rather than doing the filtering in the chat server.  That way the logic is per user rather than global.

Does this help?
 

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




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics
chat_done.tgz

Oleg G.

unread,
Oct 14, 2010, 12:00:33 AM10/14/10
to Lift
Thank you, David.

The sample code helped. The key is to keep a session->actor map (or
session var) to target the updates, i was not sure if it is a good
solution until i've seen your code.

On Oct 14, 12:39 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Wed, Oct 13, 2010 at 3:48 AM, Oleg G. <ojo...@gmail.com> wrote:
> > Hi all,
>
> > I'm trying to add a filter to a comet chat, i have different kind of
> > messages, everything else is based on the lift's comet chat example.
>
> You might try looking at the code that I wrote for the CUFP Lift tutorial...
> it gives you multiple chat rooms... while this isn't filtering, it'll give
> you an idea of how to do things differently on a per user basis.
>
> > So there are some checkboxes to exclude certain kind of messages, all
> > is working but currently i'm updating all listeners of the ChatServer
> > every time someone changes their filter. I've looked through API docs
> > and source code and couldn't figure out a good way to only send update
> > to one session.
>
> > Any hints?
>
> Personally, I'd do all the filtering in the CometActor rather than doing the
> filtering in the chat server.  That way the logic is per user rather than
> global.
>
> Does this help?
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Blog:http://goodstuff.im
> Surf the harmonics
>
>  chat_done.tgz
> 19KViewDownload
Reply all
Reply to author
Forward
0 new messages