diff options
author | Devaev Maxim <[email protected]> | 2018-11-27 12:05:38 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-11-27 12:05:38 +0300 |
commit | 1897d72b5191ba88130f99feec302ea95b4ce6cd (patch) | |
tree | 39b235ae1182aca7fd667577868a65ba9dc9f6b8 /web/js/kvm/session.js | |
parent | b5ca09f310ade56ead145db4aee892d50cfd6386 (diff) |
refactoring
Diffstat (limited to 'web/js/kvm/session.js')
-rw-r--r-- | web/js/kvm/session.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/js/kvm/session.js b/web/js/kvm/session.js index cbf268d9..9589abab 100644 --- a/web/js/kvm/session.js +++ b/web/js/kvm/session.js @@ -39,6 +39,7 @@ function Session() { document.title = "Pi-KVM Session"; } } + $("about-version-kvmd").innerHTML = state.version.kvmd; $("about-version-streamer").innerHTML = `${state.version.streamer} (${state.streamer})`; }; @@ -46,6 +47,7 @@ function Session() { var __startPoller = function() { $("link-led").className = "led-yellow"; $("link-led").title = "Connecting..."; + var http = tools.makeRequest("GET", "/ws_auth", function() { if (http.readyState === 4) { if (http.status === 200) { @@ -63,9 +65,9 @@ function Session() { }; var __wsOpenHandler = function(event) { + tools.debug("Session: socket opened:", event); $("link-led").className = "led-green"; $("link-led").title = "Connected"; - tools.debug("Session: socket opened:", event); __hid.setSocket(__ws); __missed_heartbeats = 0; __ping_timer = setInterval(__pingServer, 1000); @@ -99,16 +101,20 @@ function Session() { }; var __wsCloseHandler = function(event) { - $("link-led").className = "led-gray"; tools.debug("Session: socket closed:", event); + + $("link-led").className = "led-gray"; + if (__ping_timer) { clearInterval(__ping_timer); __ping_timer = null; } + __streamer.clearState(); __atx.clearState(); __hid.setSocket(null); __ws = null; + setTimeout(function() { $("link-led").className = "led-yellow"; setTimeout(__startPoller, 500); |