Salut,
Cam Bazz wrote:
> Salut Jean,
>
> CometContext<?> context =
> CometEngine.getEngine().getCometContext("/YBZ-war/tS");
> context.notify(null);
>
>
> I got the snipped from the trunk, possibly yours. (except the static
> context "/YBZ-war/tS", that one is mine)
LOL :-)
>
>
>
> Not necessarily. When calling with null, your CometHandler.onEvent()
> will be called, and the CometEvent.attachment() will return null. I
> suspect peoples are doing that to resume a connection like:
>
> public void onEvent(CometEvent event){
> cometContext.resumeCometListener(this);
> }
>
> Hence the event.attachment() is never called.
>
>
> hmm. I am a bit confused with this one. I can understand the
> .resumeCometListener(this)
>
> but, what is the event.attachment() ????
When doing:
cometContext.notify("I'm joining the chat");
all CometHandler.onEvent(CometEvent event) will be called. When doing
event.attachment(), the value returned will be "I'm joining the chat".
That's an easy way to pass information between CometHandler (and
client). If we use the chat demo as an example, we will create a
CometHandler per user, and every time a user is sending a chat message,
we will pass that message to the CometHandler using the
CometContext.notify("") method.
How does it sound?
A+
-- Jeanfrancois
>