You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "guillaume.mary" <gu...@interview-efm.com> on 2014/07/28 14:44:37 UTC

Wicket-Atmosphere: how to post to only one client ?

Hi !

I want to implement a simple use case where a notification is sent to a
client when its reports is finished, with Wicket Atmosphere.

I’m new to Atmosphere concepts, but not to Wicket. So I had a look at
Wicket-Atmosphere Quick Start.
A broadcast is very simple to create as it is done there, but I can’t
understand how I can notify only one client. The API doesn’t seem clear to
me since the EventBus.post(..) methods talks about UUID or
AtmosphereResource.
I found AtmosphereBehavior.getUUID(Page) but how can I know on which page my
client is ? Is there any registration mecanism ? how to interrogate it ?

In my scenario, the only information I have about the client is its
sessionId.

Please advice


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-how-to-post-to-only-one-client-tp4666768.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Atmosphere: how to post to only one client ?

Posted by Pierre Goupil <go...@gmail.com>.
Yes, it should be OK.


On Mon, Jul 28, 2014 at 6:19 PM, guillaume.mary <
guillaume.mary@interview-efm.com> wrote:

> Yes, thanks for the entry point.
>
> So I came to the following solution: register a
> ResourceRegistrationListener
> on the EventBus which fills a Map (concurrent) of SessionId to UUID. The
> SessionId is took from Session.get(), and the UUID is the one from
> resourceRegistered(..).
> Then my reporter (which has the SessionId) can ask for UUID thru this Map
> and so notifies the client with post(message, uuid)
>
> It works for my prototype.
>
> Is that a correct design ?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-how-to-post-to-only-one-client-tp4666768p4666772.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
La vie est source de joie, la mort est source de paix, seule la transition
est difficile.

Re: Wicket-Atmosphere: how to post to only one client ?

Posted by "guillaume.mary" <gu...@interview-efm.com>.
Yes, thanks for the entry point.

So I came to the following solution: register a ResourceRegistrationListener
on the EventBus which fills a Map (concurrent) of SessionId to UUID. The
SessionId is took from Session.get(), and the UUID is the one from 
resourceRegistered(..).
Then my reporter (which has the SessionId) can ask for UUID thru this Map
and so notifies the client with post(message, uuid)

It works for my prototype.

Is that a correct design ?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-how-to-post-to-only-one-client-tp4666768p4666772.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket-Atmosphere: how to post to only one client ?

Posted by Pierre Goupil <go...@gmail.com>.
Good afternoon,

Yes, there is a registration mechanism. You have to implement
ResourceRegistrationListener, for instance in your Application class. Then
you have the two methods resourceRegistered & resourceUnregistered which
make you aware of the UUIDs as they come and go.

Is it clearer?

Regards,

Pierre




On Mon, Jul 28, 2014 at 2:44 PM, guillaume.mary <
guillaume.mary@interview-efm.com> wrote:

> Hi !
>
> I want to implement a simple use case where a notification is sent to a
> client when its reports is finished, with Wicket Atmosphere.
>
> I’m new to Atmosphere concepts, but not to Wicket. So I had a look at
> Wicket-Atmosphere Quick Start.
> A broadcast is very simple to create as it is done there, but I can’t
> understand how I can notify only one client. The API doesn’t seem clear to
> me since the EventBus.post(..) methods talks about UUID or
> AtmosphereResource.
> I found AtmosphereBehavior.getUUID(Page) but how can I know on which page
> my
> client is ? Is there any registration mecanism ? how to interrogate it ?
>
> In my scenario, the only information I have about the client is its
> sessionId.
>
> Please advice
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-how-to-post-to-only-one-client-tp4666768.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
La vie est source de joie, la mort est source de paix, seule la transition
est difficile.