Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7.2
    • Component/s: client-jquery
    • Labels:
      None
    • Environment:

      Ubuntu 10.10, FireFox 3.6.13, FireFox 4.0.b13

      Description

      I'm having a problem with firefox not consistently being able to lsiten for
      new server sent notification. I'm using Tomcat 7.0.8 and Atmosphere 6.5.

      The server will push the server's timestamp to the client every 5 seconds.

      What happens:
      In Google Chrome 9.0.597.94 beta:
      Works as expected always, that is the pushed response from the server is
      appended to the #messages element in the page

      FireFox 3.6.13: The messages will not always be received. That is, if one
      message is received, then all subsequent messages will also be. However,
      there seems to be a problem with the initial "handshake". By refreshing the
      page it seems to fix itself. Refresh again and the problem is back.

      Example code: http://ethlo.no/codeexamples/asynctest/asynctest.zip

      You should see messages appear in the page.

      Using firebug I can see that there are two opened connections and the scripts active connection is not the right one, so subscribe callback never sees any messages. If i move the variable ajaxRequest up as an instance variable like seen below it will work.

      jQuery.atmosphere = function()
      {
          var ajaxRequest;
      

        Activity

        Hide
        croser added a comment -

        same problem here. would be grateful for a workaround. thanks!

        Show
        croser added a comment - same problem here. would be grateful for a workaround. thanks!
        Hide
        jfarcand added a comment -

        Working on it. I will push the proposed patch so if you can confirm it works, I will cut 0.7.1 so both of you have an official version.

        Show
        jfarcand added a comment - Working on it. I will push the proposed patch so if you can confirm it works, I will cut 0.7.1 so both of you have an official version.
        Hide
        jfarcand added a comment -

        Hum...it doesn't work for me when I apply the patch using Atmosphere 0.7, Tomcat 6.0.x with both Chrome and Firefox.

        Show
        jfarcand added a comment - Hum...it doesn't work for me when I apply the patch using Atmosphere 0.7, Tomcat 6.0.x with both Chrome and Firefox.
        Hide
        jfarcand added a comment -

        Just a quick status, the test case works fine with the patch but all the Atmosphere sample are broken. So we need a better solution Will try to take a look today.

        Show
        jfarcand added a comment - Just a quick status, the test case works fine with the patch but all the Atmosphere sample are broken. So we need a better solution Will try to take a look today.
        Hide
        vbarrier added a comment -

        I found a quick (maybe dirty) fix :

        let the ajaxRequest at the original place but :

        Change the begin with :

        jQuery.atmosphere = function()
        {
            var activeRequest;
            var ajaxRequests = new Array();
            jQuery(window).unload(function()
            {
                for ( var i=0, len=ajaxRequests.length; i<len; ++i ){
                    var request=ajaxRequests[i];
                    request.onreadystatechange = function () {};
                    request.abort();
                }
        
                if( !(typeof(transferDoc) == 'undefined') ){
                    if(transferDoc != null){
                        transferDoc = null;
                        CollectGarbage();
                    }
                }
            });
        

        add :

          ajaxRequests.push(ajaxRequest);
        

        after :

        } else if (window.XMLHttpRequest) {
            ajaxRequest = new XMLHttpRequest();
        }
        

        This way you will always abort all ajax request.

        And... samples still works

        Show
        vbarrier added a comment - I found a quick (maybe dirty) fix : let the ajaxRequest at the original place but : Change the begin with : jQuery.atmosphere = function() { var activeRequest; var ajaxRequests = new Array(); jQuery(window).unload(function() { for ( var i=0, len=ajaxRequests.length; i<len; ++i ){ var request=ajaxRequests[i]; request.onreadystatechange = function () {}; request.abort(); } if ( !(typeof(transferDoc) == 'undefined') ){ if (transferDoc != null ){ transferDoc = null ; CollectGarbage(); } } }); add : ajaxRequests.push(ajaxRequest); after : } else if (window.XMLHttpRequest) { ajaxRequest = new XMLHttpRequest(); } This way you will always abort all ajax request. And... samples still works
        Hide
        jfarcand added a comment -
        Show
        jfarcand added a comment - Fixed by http://java.net/jira/browse/ATMOSPHERE-116

          People

          • Assignee:
            Unassigned
            Reporter:
            ethlo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: