From b688a909b0066aed30320dd96fbced0f74da7f2c Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Thu, 15 Dec 2011 13:59:35 -0600 Subject: [PATCH] Show close code and reason. Also add commented out web-socket-js debug variable in include/websock.js --- include/rfb.js | 5 ++++- include/websock.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/rfb.js b/include/rfb.js index 9dceea7..f684804 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -225,7 +225,10 @@ function constructor() { fail("Got unexpected WebSockets connection"); } }); - ws.on('close', function() { + ws.on('close', function(e) { + if (e.code) { + Util.Info("Close code: " + e.code + ", reason: " + e.reason + ", wasClean: " + e.wasClean); + } if (rfb_state === 'disconnect') { updateState('disconnected', 'VNC disconnected'); } else if (rfb_state === 'ProtocolVersion') { diff --git a/include/websock.js b/include/websock.js index a688f76..f293ce8 100644 --- a/include/websock.js +++ b/include/websock.js @@ -24,6 +24,10 @@ if (window.WebSocket) { window.WebSocket = window.MozWebSocket; } else { /* no builtin WebSocket so load web_socket.js */ + + // To enable debug: + // window.WEB_SOCKET_DEBUG=1; + Websock_native = false; (function () { function get_INCLUDE_URI() { -- 2.39.5