diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index 6f4f07c72b..702998cc58 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -359,6 +359,11 @@ return self._ws_socket ? true : false; }; + $.JsonRpcClient.prototype.stopRetrying = function() { + if (self.to) + clearTimeout(self.to); + } + $.JsonRpcClient.prototype._getSocket = function(onmessage_cb) { // If there is no ws url set, we don't have a socket. // Likewise, if there is no window.WebSocket. diff --git a/html5/verto/verto_communicator/src/partials/ws_reconnect.html b/html5/verto/verto_communicator/src/partials/ws_reconnect.html index 7879b587f7..dbb2119c27 100644 --- a/html5/verto/verto_communicator/src/partials/ws_reconnect.html +++ b/html5/verto/verto_communicator/src/partials/ws_reconnect.html @@ -2,7 +2,7 @@ diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index 9aa4414bf5..a1330be0d6 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -143,6 +143,8 @@ * not connecting prevent two connects */ if (storage.data.ui_connected && storage.data.ws_connected && !verto.data.connecting) { + verto.data.hostname = storage.data.hostname || verto.data.hostname; + verto.data.wsURL = storage.data.wsURL || verto.data.wsURL; verto.data.name = storage.data.name; verto.data.email = storage.data.email; verto.data.login = storage.data.login; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 223d2f8b34..ba305c363c 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -85,6 +85,8 @@ $scope.$apply(function() { verto.data.connecting = false; if (connected) { + storage.data.hostname = verto.data.hostname; + storage.data.wsURL = verto.data.wsURL; storage.data.ui_connected = verto.data.connected; storage.data.ws_connected = verto.data.connected; storage.data.name = verto.data.name; @@ -206,10 +208,10 @@ $rootScope.$on('ws.close', onWSClose); $rootScope.$on('ws.login', onWSLogin); - var ws_modalInstance; + $rootScope.ws_modalInstance; function onWSClose(ev, data) { - if(ws_modalInstance) { + if($rootScope.ws_modalInstance) { return; }; var options = { @@ -217,7 +219,7 @@ keyboard: false }; if ($scope.showReconnectModal) { - ws_modalInstance = $scope.openModal('partials/ws_reconnect.html', 'ModalWsReconnectController', options); + $rootScope.ws_modalInstance = $scope.openModal('partials/ws_reconnect.html', 'ModalWsReconnectController', options); }; }; @@ -225,12 +227,12 @@ if(storage.data.autoBand) { verto.testSpeed(); } - if(!ws_modalInstance) { + if(!$rootScope.ws_modalInstance) { return; }; - ws_modalInstance.close(); - ws_modalInstance = null; + $rootScope.ws_modalInstance.close(); + $rootScope.ws_modalInstance = null; }; $scope.showAbout = function() { diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js index 374ad18c8d..6536e2f2ca 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js @@ -5,10 +5,20 @@ .module('vertoControllers') .controller('ModalWsReconnectController', ModalWsReconnectController); - ModalWsReconnectController.$inject = ['$scope', 'storage', 'verto']; + ModalWsReconnectController.$inject = ['$rootScope', '$scope', 'storage', 'verto']; - function ModalWsReconnectController($scope, storage, verto) { + function ModalWsReconnectController($rootScope, $scope, storage, verto) { console.debug('Executing ModalWsReconnectController'); + + $scope.closeReconnect = closeReconnect; + + function closeReconnect() { + if ($rootScope.ws_modalInstance && verto.data.instance) { + verto.data.instance.rpcClient.stopRetrying(); + $rootScope.ws_modalInstance.close(); + delete verto.data.instance; + } + }; }; diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index cb35195a82..91ad8a5d87 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -698,7 +698,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora // Checking if we have a failed connection attempt before // connecting again. if (data.instance && !data.instance.rpcClient.socketReady()) { - clearTimeout(data.instance.rpcClient.to); + data.instance.rpcClient.stopRetrying(); data.instance.logout(); data.instance.login(); return; @@ -735,7 +735,6 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora onResCheck: that.refreshVideoResolution }); } - if (data.mediaPerm) { ourBootstrap(); } else {