tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pieter Fibbe <>
Subject What is a typical Comet event flow, with multiple READ events?
Date Wed, 03 Jun 2009 10:32:23 GMT

I have been trying to write a Comet webapp, but it's not totally clear
to me when and how CometEvents are exactly triggered. According to the
documentation a "typical life cycle of a Comet request will consist in
a series of events such as: BEGIN -> READ -> READ -> READ ->

It seems that a READ event is triggered only by a POST request, but
the "event flow" that I am getting never triggers more that one READ
event in a row, for example: BEGIN-> ->READ->END, BEGIN-> ->READ->END,
etc. Is the way a comet application should work? So you have to
establish a new connection every time you get a response from the
server and wait for the next response, process it and start from the
beginning? My idea was having one connection and reuse that connection
for multiple requests. So on the client side there would be something
like the following code:

var xhr;
function init() {
	xhr = new XMLHttpRequest();

function triggerEvent() {"POST", "/servlets/cometservlet", true);
<input type="button" onclick="triggerEvent" />

Since it is not possible to invoke xhr.send() several times without
opening the connection first (, a CometEvent.BEGIN is
always triggered first. So how can the "BEGIN -> READ -> READ -> READ"
series (given in the documentation) be implemented?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message