users@grizzly.java.net

Re: GWT + Comet question (was Re: [Jean-Francois Arcand's Blog] New Comment Posted to 'Building GWT Comet based web app using Grizzly Comet'

From: jewel_kader <tojewel_at_gmail.com>
Date: Thu, 26 Mar 2009 01:58:48 -0700 (PDT)

Hi Jeanfrancois,

Since I am using GWT and Grizzly in a project, I eventually have to write
something that works in real application. I am planning to publish the comet
related code under a open source project. So that other people can take a
look and let us know, if there is something wrong.

Many thanks for your help.

--Jewel


Jeanfrancois Arcand-2 wrote:
>
> Salut,
>
> jewel_kader wrote:
>> Hi Jeanfrancois,
>>
>> Long polling seems to work in IE after doing a trick.
>>
>> Flushing a arbitrary string or a comment causes a error in GWT's RPC
>> system.
>> Flushing something like
>> "//OK[2,1,[\"com.game.chess.client.Message/483634159\",\"123\"],0,5]"
>> (which
>> GWT understand) before suspending the connection, prevents the error.
>> However this flushed data don't came to the browser immediately. Rather,
>> onEvent sending another data
>> ("//OK[2,1,[\"com.game.chess.client.Message/483634159\",\"456\"],0,5]")
>> and
>> resuming the handler, results reaching the data at the client side.
>> However,
>> the GWT client seems to care only the first part of the data and discard
>> the
>> original (2nd) part.
>>
>> So I flushed a part of the String ("//OK") at first and onEvent wrote
>> rest
>> of the encoded string
>> ("[2,1,[\"com.game.chess.client.Message/483634159\",\"456\"],0,5]") and
>> this
>> seems to work in IE and FF. GWT's RPC is also happy.
>
> This is great. Are you planning to blog about this :-) ?
>
> Let us know if you have any more issues. Hopefully I reply faster once
> ApacheCon is finished.
>
> A+
>
> --Jeanfrancois
>
>
>>
>> Thanks,
>>
>> --Jewel
>>
>>
>>
>> jewel_kader wrote:
>>> Hi Jeanfrancois,
>>>
>>> In my example I used new
>>> PrintWriter(HttpResponse.getOutputStream()).flush(). I also tried
>>> HttpResponse.getWriter().flush() but this made no change.
>>>
>>> Right now, I am writing a pub/sub pattern based wrapper on top of
>>> Grizzly
>>> and GWT. Grizzly at least can suspend a connection of IE and notify the
>>> client in future. Though it can't propagate right the message, I guess
>>> based on that I have to write a different adapter for IE to send the
>>> right
>>> message to the client.
>>>
>>> I downloaded ngrep.sourceforge.net, wireshark. Unfortunately, I am not
>>> so
>>> familiar with those. I will let you know if I make any progress.
>>>
>>> Many thanks for you help.
>>>
>>> --Jewel
>>>
>>>
>>> Jeanfrancois Arcand-2 wrote:
>>>> Salut,
>>>>
>>>> jewel_kader wrote:
>>>>> Hi,
>>>>>
>>>>> In IE, flushing a comment causes a
>>>>> com.google.gwt.user.client.rpc.InvocationException at the client side.
>>>>> However writing something that GWT understand works. For example,
>>>>> instead of
>>>>> writing a comment before calling addCometHandler, I flushed
>>>>> "//OK[2,1,[\"com.game.chess.client.Message/483634159\",\"123\"],0,5]",
>>>>> which
>>>>> is a encoded response string in gwt way.
>>>>>
>>>>> This process suspends the response successfully but on comet event,
>>>>> when
>>>>> I
>>>>> tried to send my own data, only the previously written (flushed before
>>>>> addCometHandler) data came to the client.
>>>> Ok making progress. I'm on the road and don't have IE availble so
>>>> trying
>>>> to help. Can you invoke the HttpResponse.getWriter().flush() everytime
>>>> you write something? Also, do you think you can install
>>>> ngrep.sourceforge.net or wireshark and snoop the network to see if the
>>>> bytes are sent to the browser?
>>>>
>>>> Apology for not being able to help here more...no IE on Ubuntu/OS X :-)
>>>>
>>>> A+
>>>>
>>>> -- Jeanfrancois
>>>>
>>>>> Thanks,
>>>>>
>>>>> --Jewel
>>>>>
>>>>>
>>>>> Jeanfrancois Arcand-2 wrote:
>>>>>> Salut,
>>>>>>
>>>>>> dun4n wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> it's just an idea but you could try to flush some kb of comments
>>>>>>> before.
>>>>>>> Some browsers like Safari requires some kb of data at the beginning
>>>>>>> of
>>>>>>> the stream to start the rendering.
>>>>>>> And be sure you are not running some kind of service like Avast
>>>>>>> WebShield which is buffering a http stream before rendering it.
>>>>>> Yes the comet-jmaki demo seemed to work when flushing some bytes
>>>>>> before
>>>>>> suspending the connection. I don't have a win32 machine available
>>>>>> this
>>>>>> week but I do think this is related.
>>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>
>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/GWT-%2B-Comet-question-%28was-Re%3A--Jean-Francois-Arcand%27s-Blog--New-Comment-Posted-to-%27Building-GWT-Comet-based-web-app-using-Grizzly-Comet%27-tp21416392p22718098.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.