summaryrefslogtreecommitdiff
path: root/www/js/EventServer.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-10-31 09:10:54 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-10-31 09:10:54 -0400
commit91c6171487cc4f88b935deb8b3cf61ef9728e009 (patch)
tree575d1735d6412e9f5cb79bfc983c51c8414b33c8 /www/js/EventServer.js
parent510b9e0b70c538a4ae84b428046ad519e2e7f6b5 (diff)
send ES monlist along with auth. Needed for https://github.com/pliablepixels/zmeventserver/issues/57
Diffstat (limited to 'www/js/EventServer.js')
-rw-r--r--www/js/EventServer.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js
index 68c21e9a..5ef0a260 100644
--- a/www/js/EventServer.js
+++ b/www/js/EventServer.js
@@ -17,6 +17,7 @@ angular.module('zmApp.controllers')
var pushInited = false;
var isTimerOn = false;
var nativeWebSocketId = -1;
+ var iClosed = false;
@@ -31,7 +32,10 @@ angular.module('zmApp.controllers')
NVRDataModel.log("openHandshake: Websocket open, sending Auth");
sendMessage("auth", {
user: loginData.username,
- password: loginData.password
+ password: loginData.password,
+ monlist: loginData.eventServerMonitors,
+ intlist: loginData.eventServerInterval
+
});
@@ -63,6 +67,13 @@ angular.module('zmApp.controllers')
function handleClose(event) {
+
+ if (iClosed) {
+ NVRDataModel.debug ("App closed socket, not reconnecting");
+ iClosed = false;
+ return;
+ }
+
console.log("*********** WEBSOCKET CLOSE CALLED");
if (!NVRDataModel.getLogin().isUseEventServer) return;
@@ -99,6 +110,7 @@ angular.module('zmApp.controllers')
if (str.reason == 'APNSDISABLED') {
console.log("FORCE CLOSING");
+ iClosed=true;
ws.close();
NVRDataModel.displayBanner('error', ['Event Server: APNS disabled'], 2000, 6000);
$rootScope.apnsToken = "";
@@ -319,7 +331,7 @@ angular.module('zmApp.controllers')
NVRDataModel.log("Clearing error/close cbk, disconnecting and deleting Event Server socket...");
- if ($rootScope.platforOS == 'desktop') {
+ if ($rootScope.platformOS == 'desktop') {
if (typeof ws === 'undefined') {
NVRDataModel.log("Event server socket is empty, nothing to disconnect");
return;
@@ -327,10 +339,12 @@ angular.module('zmApp.controllers')
ws.onmessage = null;
+ iClosed = true;
ws.close();
ws = undefined;
} else {
if (nativeWebSocketId != -1) //native;
+ iClosed = true;
CordovaWebsocketPlugin.wsClose(nativeWebSocketId, 1000, "Connection closed");
nativeWebSocketId = -1;
@@ -523,10 +537,6 @@ angular.module('zmApp.controllers')
}
-
-
- //console.log ("WUTPUT SENDING REG WITH "+monstring);
-
$rootScope.monstring = monstring;
$rootScope.intstring = intstring;