summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-04-22 15:24:32 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-04-22 15:24:32 -0400
commitcf644cc65b462362474512160eb0ae1f51a0b158 (patch)
tree89c983eeb9ca6530d79ea207adbb0fc8ac8965d3 /www/js
parentaac1f8e7a84cf5e4f0603ef66433b91008365300 (diff)
#604 don't reconnect onClose only onError
Diffstat (limited to 'www/js')
-rw-r--r--www/js/EventServer.js30
1 files changed, 5 insertions, 25 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js
index a300e346..ab2a0c27 100644
--- a/www/js/EventServer.js
+++ b/www/js/EventServer.js
@@ -17,8 +17,7 @@ angular.module('zmApp.controllers')
var localNotificationId = 0;
var pushInited = false;
var isTimerOn = false;
- var initCalled = false;
- var timeOfInit = -1;
+
//--------------------------------------------------------------------------
@@ -90,8 +89,8 @@ angular.module('zmApp.controllers')
function init()
{
- // only log the time for the first init
- if (timeOfInit == -1) timeOfInit = new Date();
+
+
$rootScope.isAlarm = 0;
$rootScope.alarmCount = "0";
@@ -150,27 +149,9 @@ angular.module('zmApp.controllers')
ws.onError(function (e)
{
- // we don't need this check as I changed reconnect interval to 60s
- //if ((Date.now() - lastEventServerCheck > 30000.0) || firstError)
-
-
NVRDataModel.debug("Websocket Errorhandler called");
- var curr = new Date();
- var sec = Math.round((curr.getTime() - timeOfInit.getTime())/1000);
- console.log (">>> TIME ELAPSED:"+sec);
-
- if (!initCalled || timeOfInit == -1) {
- NVRDataModel.log ("Ignoring websocket error as init not yet called");
- return;
- }
-
- if (sec < zm.eventServerErrorDelay) {
- NVRDataModel.log ("Ignoring websocket error as its too soon ("+sec+"s), may be residual error ");
- return;
- }
-
$timeout(function()
{
var eserr = $translate.instant('kEventServerConnErr');
@@ -206,12 +187,12 @@ angular.module('zmApp.controllers')
var ld = NVRDataModel.getLogin();
- if (ld.isUseEventServer && !isTimerOn) {
+ /* if (ld.isUseEventServer && !isTimerOn) {
// this means remote error, because zmN still
// wants it on
$timeout ( init, 10000 );
isTimerOn = true;
- }
+ }*/
});
@@ -342,7 +323,6 @@ angular.module('zmApp.controllers')
function disconnect()
{
- timeOfInit = -1;
if (typeof ws === 'undefined') {
NVRDataModel.log("Event server socket is empty, nothing to disconnect");
return;