users@grizzly.java.net

Re: comet context question

From: Cam Bazz <cambazz_at_gmail.com>
Date: Wed, 2 Jul 2008 04:34:05 +0300

excellent, I almost got my stuff working.

with the exception of x-json header. I am using jquery, and the example
(comet-count) uses prototype lib with behaivor.

I can not find a way to access the response header from jquery, nor any
documentation about x-json?

what is this X-JSON ?

Best,

On Wed, Jul 2, 2008 at 4:30 AM, Jeanfrancois Arcand <
Jeanfrancois.Arcand_at_sun.com> wrote:

> 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
>
>
>
>
>
>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>