users@glassfish.java.net

Re: Grizzly Comet

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 30 Mar 2007 10:33:23 -0400

Hi,

glassfish_at_javadesktop.org wrote:
> Thanks, have you worked with it?

Yes ;-)

Is it possible to update only certain clients?

Yes, it is. The CometContext API have:

> public void notify(final E attachment,final int eventType,final int cometHandlerID)

The cometHandlerId is retrieved when doing

> public int addCometHandler(CometHandler handler){

the 'int' returned by that method is the unique cometHandlerId ID to use
when notifying a single Client. The code described in [1] has an example
if you want to take a look at (the unique ID is used by the moderator).
I've also added an example that use two CometContexts (shareable space)
in [2]. In [2], instead of notifying a single user, I'm creating
restricted CometContext so only a subset of the client can be notified.

Hope that help!

-- Jeanfrancois

[1]
http://weblogs.java.net/blog/jfarcand/archive/2006/10/writting_a_come.html
[2]
http://weblogs.java.net/blog/jfarcand/archive/2007/03/jmaki_comet_orb_1.html


  I mean, imagine server updates price products but clients subscribe
some products, so server notify changes only for the products the client
is subscribe...
>
> Thanks again
> [Message sent by forum member 'rodrigo_olmo' (rodrigo_olmo)]
>
> http://forums.java.net/jive/thread.jspa?messageID=210576
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>