You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by John Dous <jo...@hotmail.com> on 2009/04/06 14:35:30 UTC

How to produce a Comet READ Event (EventType.READ) from the client side?‏

Hello, 
 
Recently I started to develop a web application
that is based on the Comet Architecture. After a lot of research, I realize
that there is a lack of documentation and tutorials about how to build simple Comet
applications on Tomcat. The tomcat Advanced IO documentation previews the way
that the server handles the incoming different type events, but doesn’t explain
how to produce these events from the client side (ex. IE, Firefox). The javascript snippet
below produces such an event. 
 
 
 
function newConnection(){
 
xhr = new XMLHttpRequest();
 
xhr.open('GET','/comet' ,true);
 
xhr.send(null);
 
}
 
When I execute this function, a new event (EventType.Begin)
arrives on the CometServlet. 
 
I am wondering if there is way to produce an (EventType.READ)
event from the client side.

Any suggestions?
Thanks in advance!


_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

RE: How to produce a Comet READ Event (EventType.READ) from the client side?‏

Posted by John Dous <jo...@hotmail.com>.
Thanks for your quick response. 

I changed my javascript function as below :

function connection(){
url = "/comet?nickname="+$F('nickname');
cometXHR.open("POST",url,true);
cometXHR.setRequestHeader('Content-Type','multipart/mixed');
cometXHR.setRequestHeader('Transfer-Encoding','chunked');
cometXHR.send("hello1");   
}

This really produces firstly a BEGIN event and secondly a READ event. But how to push new data from the client now? If I run again this function, a new BEGIN event will be produced and after that a READ event. I would like to produce only READ events, something like to send chunk data to server!

Any suggestion?

Regards,
John

> Date: Mon, 6 Apr 2009 15:08:38 -0600
> From: devlists@hanik.com
> To: dev@tomcat.apache.org
> Subject: Re: How to produce a Comet READ Event (EventType.READ) from the client side?‏
> 
> Comet READ events are generating when there is a POST method with a body
> 
> John Dous wrote:
> > Hello, 
> >  
> > Recently I started to develop a web application
> > that is based on the Comet Architecture. After a lot of research, I realize
> > that there is a lack of documentation and tutorials about how to build simple Comet
> > applications on Tomcat. The tomcat Advanced IO documentation previews the way
> > that the server handles the incoming different type events, but doesn’t explain
> > how to produce these events from the client side (ex. IE, Firefox). The javascript snippet
> > below produces such an event. 
> >  
> >  
> >  
> > function newConnection(){
> >  
> > xhr = new XMLHttpRequest();
> >  
> > xhr.open('GET','/comet' ,true);
> >  
> > xhr.send(null);
> >  
> > }
> >  
> > When I execute this function, a new event (EventType.Begin)
> > arrives on the CometServlet. 
> >  
> > I am wondering if there is way to produce an (EventType.READ)
> > event from the client side.
> >
> > Any suggestions?
> > Thanks in advance!
> >
> >
> > _________________________________________________________________
> > Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
> >
> > http://www.microsoft.com/windows/windowslive/products/photos.aspx
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 

_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

Re: How to produce a Comet READ Event (EventType.READ) from the client side?‏

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Comet READ events are generating when there is a POST method with a body

John Dous wrote:
> Hello, 
>  
> Recently I started to develop a web application
> that is based on the Comet Architecture. After a lot of research, I realize
> that there is a lack of documentation and tutorials about how to build simple Comet
> applications on Tomcat. The tomcat Advanced IO documentation previews the way
> that the server handles the incoming different type events, but doesn’t explain
> how to produce these events from the client side (ex. IE, Firefox). The javascript snippet
> below produces such an event. 
>  
>  
>  
> function newConnection(){
>  
> xhr = new XMLHttpRequest();
>  
> xhr.open('GET','/comet' ,true);
>  
> xhr.send(null);
>  
> }
>  
> When I execute this function, a new event (EventType.Begin)
> arrives on the CometServlet. 
>  
> I am wondering if there is way to produce an (EventType.READ)
> event from the client side.
>
> Any suggestions?
> Thanks in advance!
>
>
> _________________________________________________________________
> Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
>
> http://www.microsoft.com/windows/windowslive/products/photos.aspx
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org