summaryrefslogtreecommitdiff
path: root/kvmd/web/js/session.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-07-15 12:42:06 +0300
committerDevaev Maxim <[email protected]>2018-07-15 12:42:06 +0300
commitac9b1aef7eabe94a5f084b3bd77d7069ff95c5a1 (patch)
tree45ff2e1a78674614be749ecc4fdb13514a3ec084 /kvmd/web/js/session.js
parent25ddee3fb14f94242c6bb466f22cef37962c1620 (diff)
minor js fix
Diffstat (limited to 'kvmd/web/js/session.js')
-rw-r--r--kvmd/web/js/session.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/kvmd/web/js/session.js b/kvmd/web/js/session.js
index 31a76f68..c46d228e 100644
--- a/kvmd/web/js/session.js
+++ b/kvmd/web/js/session.js
@@ -33,6 +33,7 @@ var session = new function() {
var __wsErrorHandler = function(event) {
tools.error("WebSocket error:", event);
__ws.close();
+ __ws = null;
};
var __wsCloseHandler = function(event) {
@@ -55,7 +56,10 @@ var session = new function() {
__ws.send(JSON.stringify({"event_type": "ping"}));
} catch (err) {
tools.error("Ping error:", err.message);
- __ws.close();
+ if (__ws) {
+ __ws.close();
+ __ws = null;
+ }
}
};
};