I can not unsubscribe web socket in Firefox

282 views Asked by At

I'm using atmosphere and angularJS for creating the client application. I want to unsubscribe ws when user click Back button in browser or change location page. My code was working normally in Chrome 38, Safari but not working in Firefox 33. I'm using angular-atmosphere-service to handle ws.

Link: github.com > spyboost > angular-atmosphere-service.js

var unbindHandler = $scope.$on('$locationChangeStart', function (event, next, current) {
  var path = $location.path();
  event.preventDefault();

  showPopupAlert('confirm', $('#popup_alert'),
    function () {
      try {
        atmosphereService.unsubscribe(request);
      } catch(e) {
        $log.debug(e);
      }
      $scope.$apply(function () {
        unbindHandler();
        $location.url(path).replace();
      });
    }, function () {
    }, errorMes('client.changepage.on.pumping'));
});


function showPopupAlert(type, obj, confirmFunction, rejectFunction, message) {
  if (type != 'confirm') {
    obj.find('#btn-cancel').hide();
  } else {
    obj.find('#btn-cancel').show();
  }

  obj.find('#question').html(message);
  obj.modal('show');

  obj.find('#btn-ok').unbind().bind('click', function () {
    obj.modal('hide');
    if (confirmFunction !== 0) {
      confirmFunction();
    }
  });

  obj.find('#btn-cancel').unbind().bind('click', function () {
    obj.modal('hide');
    if (rejectFunction !== 0) {
      rejectFunction();
    }
  });
}

Open console log in Firefox, I got an object

columnNumber

0

data

null

filename

"http://192.168.1.102/ser.../libs/atmosphere-min.js"

inner

null

lineNumber

635

message

""

name

""

result

2153644038

stack

"J@http://192.168.1.102/s...query/jquery.js:3:4749\n"

proto

Object { toString=toString(), message=undefined, name=undefined}
0

There are 0 answers