Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13875

RF 4.5 : a4j:push component fails on reconnect in push-demo

    Details

    • Sprint:
      4.5.0.CR2 - Sprint 2
    • Steps to Reproduce:
      Hide

      1) Checkout richfaces 4.5.0.CR1
      2) Build and deploy push-demo to GF4
      3) Open producer and consumer page

      Show
      1) Checkout richfaces 4.5.0.CR1 2) Build and deploy push-demo to GF4 3) Open producer and consumer page

      Description

      Steps to reproduce

      1) Checkout richfaces 4.5.0.CR1
      2) Build and deploy push-demo to GF4
      3) Open producer and consumer page

      Szenario:

      • Successful handshake after opening consumerpage
      • push on producer page works and is shown on consumer page
      • Connection is closed with message.code: 1000
      • after 5 reconnects (2' 30'') the websocket connection is not opend again and push-demo is not working any longer

      richfaces-core/resources/net.java.dev.atmosphere/jquery-atmosphere.js

       
      // websocket connection is closed with message.code 1000: 
      1277:                _websocket.onclose = function (message) {
      ...
      1282:                    var reason = message.reason;
      1283:                    if (reason === "") {
      1284:                        switch (message.code) {
      1285:                            case 1000:
      1286:                                reason = "Normal closure; the connection successfully completed whatever purpose for which " + "it was created.";
      1287:                                break;
      ...
      // reconnect is true, protocoll is websocket and message.code !== 1001 => true
      1329:                    } else if (_request.reconnect && _response.transport === 'websocket' && message.code !== 1001) {
      1330:                        _clearState();
      // after 5 reconnects websocket is not reconnected => else
      1331:                        if ( _requestCount++ < _request.maxReconnectOnClose) {
      ...
      // error handling 
      1345:                        } else {
      1346:                            jQuery.atmosphere.log(_request.logLevel, ["Websocket reconnect maximum try reached " + _request.requestCount]);
      1347:                            if (_request.logLevel === 'warn') {
      1348:                                jQuery.atmosphere.warn("Websocket error, reason: " + message.reason);
      1349:                            }
      1350:                            _onError(0, "maxReconnectOnClose reached");
      1351:                        }
      1352:                    }
      1353:                };
      

      I locally have added a check against unlimeted max requests to line 1331:

      richfaces-core/resources/net.java.dev.atmosphere/jquery-atmosphere.js

       
      1331:                       if (_request.maxRequest === -1 || _requestCount++ < _request.maxReconnectOnClose) {
      

      This is working for me and the push-demo is working properbly.

      Best regards,
      Stefan

        Gliffy Diagrams

          Attachments

          1. Console_Log.png
            Console_Log.png
            11 kB
          2. RF_41.png
            RF_41.png
            69 kB
          3. RF_45_Push-demo.png
            RF_45_Push-demo.png
            68 kB
          4. RF_45.png
            RF_45.png
            42 kB

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                snolting Stefan Nolting
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 hours
                  2h
                  Remaining:
                  Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified