A Comet implementation for Google Web

9 views
Skip to first unread message

Luca Masini

unread,
Jul 9, 2006, 12:01:01 PM7/9/06
to Google Web Toolkit
This GWT component allows Http Streaming from the server to the client
in a Comet fashion (no pull, only push):


http://www.jroller.com/page/masini?entry=a_comet_implementation_for_google

I would love to have your feedback on how to improve it and comments in
general.
Thank you.
L.

cole...@gmail.com

unread,
Jul 10, 2006, 8:56:01 AM7/10/06
to Google Web Toolkit
Wow! Good timing. I was just about to try and implement something like
this. Looking at your blog, the API you created looks pretty clean
and simpe. Is there a license associated with your code?

Thanks,
Sam

Javid

unread,
Jul 11, 2006, 2:55:26 PM7/11/06
to Google Web Toolkit
Hey Luca,
I just came across this posting and I am very interested in using this
module. Your example shows pushing data as strings. I am little curious
if I would be able to send user defined serialized data from the server
back to the client. Any help is greatly appreciated.

Thanks,
Javid

Luca Masini

unread,
Jul 20, 2006, 8:26:50 AM7/20/06
to Google Web Toolkit
No license at all, use it as you want and if you can help me doing it
better.
Ciao.

Luca Masini

unread,
Jul 20, 2006, 8:27:31 AM7/20/06
to Google Web Toolkit
Yes, I will soon send objects using JSon. Any help is greatly
appreciated.
Ciao.

kenny

unread,
Jul 20, 2006, 5:13:37 PM7/20/06
to Google Web Toolkit
Great stuff. I'm also looking for ways to subscribe to the server's
JMS queue from Ajax client. Any chance of publishing the
StreamServiceFactory and hidden iFrame.
thanks

Javid Alimohideen

unread,
Jul 21, 2006, 11:47:46 AM7/21/06
to Google-We...@googlegroups.com
Hey Luca,
Do you have any CPU utilization problem? My CPU is constantly using 45%

Javid

  - Bill Cosby

Luca Masini

unread,
Jul 22, 2006, 10:10:04 AM7/22/06
to Google Web Toolkit
You are the second that tell me about this problem, so I would like to
investigate it. Can you give me your configuration ?

> --
> I don't know the key to success, but the key to failure is trying to please
> everybody.
> - Bill Cosby
>
> ------=_Part_62810_1236247.1153496866904
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 653
>
> Hey Luca,<br>Do you have any CPU utilization problem? My CPU is constantly using 45%<br><br>Javid<br><br><div><span class="gmail_quote">On 7/20/06, <b class="gmail_sendername">kenny</b> &lt;<a href="mailto:chau....@gmail.com">
> chau....@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Great stuff.&nbsp;&nbsp;I'm also looking for ways to subscribe to the server's
> <br>JMS queue from Ajax client.&nbsp;&nbsp;Any chance of publishing the<br>StreamServiceFactory and hidden iFrame.<br>thanks<br><br><br><br>&nbsp;&nbsp;- Bill Cosby<br>
>
> ------=_Part_62810_1236247.1153496866904--

Luca Masini

unread,
Jul 22, 2006, 10:11:31 AM7/22/06
to Google Web Toolkit
As I wrote, I will soon write a NON GWT client. Doing this we can write
a simple gateway to JMS. Or do you mean a native one ?

Javid Alimohideen

unread,
Jul 22, 2006, 11:40:15 AM7/22/06
to Google-We...@googlegroups.com
Luca,
My configration:
Server: Apache Tomcat 4.1
Client: Firefox, IE 6.0
GWT version: 1.0.21

Thanks,
Javid

spontificus

unread,
Jul 22, 2006, 12:15:02 PM7/22/06
to Google Web Toolkit

> Do you have any CPU utilization problem? My CPU is constantly using 45%

Is it possible that by simulating callbacks via an open stream, it's
the polling method which is blocking and artificially showing a high
CPU load? I'd try 2-3-4 clients at the same time and see what happens.

Richard

Luca Masini

unread,
Jul 22, 2006, 4:43:43 PM7/22/06
to Google Web Toolkit
Richard why do you say that is a polling ?
There is no polling anywhere in this implementation of this COMET (or I
couldn't call it COMET).
About the way callback is simulated, everything is done using the
Operating system I/O, so every process should be in wait state while
data is not running from server to client.

Now I did some little (really little) tests with 10 clients (all IE)
and I noticed that Tomcat's javaw.exe never tooks more than 10% when it
really sends datas (as it should), clients instead are really idle and
only take CPU time while receiving data.

Ciao

Luca Masini

unread,
Jul 22, 2006, 4:45:07 PM7/22/06
to Google Web Toolkit
But which is the process that takes so much CPU time ? Tomcat or
IE/Firefox ?

> ------=_Part_71905_10849836.1153582815436
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 2533
>
> Luca,<br>My configration:<br>Server: Apache Tomcat 4.1<br>Client: Firefox, IE 6.0<br>GWT version: 1.0.21<br><br>Thanks,<br>Javid<br><br><div><span class="gmail_quote">On 7/22/06, <b class="gmail_sendername">Luca Masini</b>
> &lt;<a href="mailto:luca....@gmail.com">luca....@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>You are the second that tell me about this problem, so I would like to
> <br>investigate it. Can you give me your configuration ?<br><br>Javid Alimohideen wrote:<br>&gt; Hey Luca,<br>&gt; Do you have any CPU utilization problem? My CPU is constantly using 45%<br>&gt;<br>&gt; Javid<br>&gt;<br>&gt; On 7/20/06, kenny &lt;
> <a href="mailto:chau....@gmail.com">chau....@gmail.com</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Great stuff.&nbsp;&nbsp;I'm also looking for ways to subscribe to the server's<br>&gt; &gt; JMS queue from Ajax client.&nbsp;&nbsp;Any chance of publishing the
> <br>&gt; &gt; StreamServiceFactory and hidden iFrame.<br>&gt; &gt; thanks<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; I don't know the key to success, but the key to failure is trying to please
> <br>&gt; everybody.<br>&gt;&nbsp;&nbsp; - Bill Cosby<br>&gt;<br>&gt; ------=_Part_62810_1236247.1153496866904<br>&gt; Content-Type: text/html; charset=ISO-8859-1<br>&gt; X-Google-AttachSize: 653<br>&gt;<br>&gt; Hey Luca,&lt;br&gt;Do you have any CPU utilization problem? My CPU is constantly using 45%&lt;br&gt;&lt;br&gt;Javid&lt;br&gt;&lt;br&gt;&lt;div&gt;&lt;span class=&quot;gmail_quote&quot;&gt;On 7/20/06, &lt;b class=&quot;gmail_sendername&quot;&gt;kenny&lt;/b&gt; &amp;lt;&lt;a href=&quot;mailto:
> <a href="mailto:chau....@gmail.com">chau....@gmail.com</a>&quot;&gt;<br>&gt; <a href="mailto:chau....@gmail.com">chau....@gmail.com</a>&lt;/a&gt;&amp;gt; wrote:&lt;/span&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt
> 0.8ex; padding-left: 1ex;&quot;&gt;&lt;br&gt;Great stuff.&amp;nbsp;&amp;nbsp;I'm also looking for ways to subscribe to the server's<br>&gt; &lt;br&gt;JMS queue from Ajax client.&amp;nbsp;&amp;nbsp;Any chance of publishing the&lt;br&gt;StreamServiceFactory and hidden iFrame.&lt;br&gt;thanks&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;- Bill Cosby&lt;br&gt;
> <br>&gt;<br>&gt; ------=_Part_62810_1236247.1153496866904--<br><br><br><br>
>
> ------=_Part_71905_10849836.1153582815436--

Javid Alimohideen

unread,
Jul 23, 2006, 1:12:40 PM7/23/06
to Google-We...@googlegroups.com
Luca,
I tested my application recently and I don't see any CPU utilization anymore (both server and client side). One small thing, I don't like in FF is since the servlet is streaming always I guess, the web app always has the progress cursor showing. Does anyone have an idea on how to make the cursor look default. I tried CSS style cursor: default for the body, but doesn't help.

Thanks,
Javid

On 7/22/06, Luca Masini <luca....@gmail.com> wrote:

Luca Masini

unread,
Jul 23, 2006, 4:59:46 PM7/23/06
to Google Web Toolkit
Ok, that's better.
I agree about Firefox too, but I don't have any idea, if you find
something please let me know.
Ciao.

Javid Alimohideen

unread,
Jul 24, 2006, 11:57:09 AM7/24/06
to Google-We...@googlegroups.com
Luca,
I am not sure if it's a bug but on the hosted mode the window resize listener doesn't work. On the web mode, it works fine. Does anyone have this issue?

Javid

  - Bill Cosby

Luca Masini

unread,
Jul 25, 2006, 8:04:44 AM7/25/06
to Google Web Toolkit
Sorry Javid, did I miss something or this has nothing to do with the
COMET ?

Javid Alimohideen

unread,
Jul 25, 2006, 11:10:31 AM7/25/06
to Google-We...@googlegroups.com
Hi Luca,
I don't think it has anything to do with COMET. But for some reason, the window resize listener does not work. The example project (chat) has the same issues. But, once compiled and hosted on the web it works fine. Very strange. I am looking at this issue, will keep you updated. Also, a request is for unsubcribe for events in the COMET implementation. Does that make sense?

Javid

On 7/25/06, Luca Masini <luca....@gmail.com> wrote:

Sorry Javid, did I miss something or this has nothing to do with the
COMET ?



  - Bill Cosby

Luca Masini

unread,
Jul 28, 2006, 5:19:06 PM7/28/06
to Google Web Toolkit
Sure, unsuscribe is absolutely necessary, I will implement it in the
next version (the one with JSON).
Thank you for your suggestion.
Ciao.
L.

Javid

unread,
Aug 16, 2006, 3:04:06 PM8/16/06
to Google Web Toolkit
Luca,
I am not sure if you have had this problem, but sometime I get an
IllegalStateException : session already invalidated error message from
the StreamingServlet code. It occurs in this block. Any idead what
could be wrong??
/**
public void update(Observable o, Object arg) {

SageServiceImpl.Event event = (SageServiceImpl.Event)arg;

if(session.getAttribute(event.queueName)!=null) //
exception occurs here
{
synchronized (eventList) {
eventList.add(event);
}
}
}
*/

Luca Masini

unread,
Aug 17, 2006, 4:25:16 AM8/17/06
to Google Web Toolkit
No, first time I see it, on which line do you have it ?
Anyway, I did a new version on July without the use of the HttpSession,
as soon as I have time I will publish it.
Ciao.

Javid Alimohideen

unread,
Aug 17, 2006, 11:28:10 AM8/17/06
to Google-We...@googlegroups.com
It happens on the update method of the observer in the streaming servlet. session.getAttribute(event.queueName).
I set the session timeout to -1 (infinite)  and it works fine.

Javid
Reply all
Reply to author
Forward
0 new messages