Hi all,

I am using Tomcat6 together with Comet. I implemented as described in the article "Advanced IO and Tomcat" the servlet, message sender ...

The main reason for using comet is that I would like to implement a kind of streaming, what means:

I am launching from the client with a AJAX request that is processed by the servlet: on the server the EventType.BEGIN is passed to the event method and than I start to run an specific algorithm. In this algorithm, whenever a specific event occurs, the message sender is notified and writes into the response write a content. This stream is send to the client, parsed and displayed in the page.

Unfortunately on the client I only see the content send from message sender after the first event. All others are not send to the client even if the message sender writes it out int the response which is still open.

On client side the javascript function (see below go()) is invoked only once. Any idea what I am doing wrong?

function go(){
        var url = "http://myHost:8080/myServlet";;
        var request = new XMLHttpRequest();
        request.open("POST", url, true);
request.setRequestHeader("Content-Type", "application/x-javascript;");
        request.onreadystatechange = function(){
                if (request.readyState == 4) {
                        if (request.status == 200) {
if (request.responseText) { document.getElementById("msgContainer").innerHTML = request.responseText;
                                }
                        }
                }
        };
        request.send(null);
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to