Note that there are some explanatory texts on larger screens.

plurals
  1. POComet Jetty/Tomcat, having some browser issues with Firefox and Chrome
    text
    copied!<p>I am exploring the use of Comet for a project I am working on.<br> I tried creating a test application first using Tomcat6 and CometProcessor API and then with Jetty7 Continuations.<br> The application is kind of working on both but I am having some issues with the actual display of messages.<br> I used the technique of creating an XMLHttpRequest Connection and keeping it open all the time so the server can continuously push data to all the clients connected whenever it is available. </p> <p>My client side code is something similar to this:</p> <pre><code>function fn(){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (xhr.readyState==3){ document.getElementById('dv').innerHTML =(xhr.responseText); } if (xhr.readyState==4){ alert ('done'); } } xhr.open("GET", "First", true); xhr.send(null); } </code></pre> <p>I found this thing of using <b>readyState 3</b> somewhere online. </p> <p>I am facing 2 problems currently:</p> <ol> <li><p>In <b>Firefox</b> this code works perfectly. But <b>if I open a new tab or even a new browser window, it does not make a new connection</b> to the server and nothing shows up on the new tab or window, only the first tab/window gets the display. I used <b>wireshark to check this</b> and its shows only 1 connection even after the 2nd tab is opened. I am unable to understand why this would happen. I have read about the 2 connection limit, but here there is only one connection.</p></li> <li><p>Secondly in <b>Chrome</b>, the above code does not work, and the <b>callback is not invoked for readystate of 3</b>, only when the connection is closed by the server i get the output.</p></li> </ol> <p>I would also like to ask which is the best way/framework for doing Comet with Java. I am currently using jQuery on the client side.<br> Any suggestions would be greatly appreciated!! Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload