From 9dccf5b0220244952ac5697f9335f7fb5f2896d7 Mon Sep 17 00:00:00 2001 From: John Shaver Date: Mon, 18 Jun 2018 11:01:12 -0700 Subject: [PATCH] Added support for onOpen/onClose/onDisconnect/onReconnect handlers --- lib/remote.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/remote.js b/lib/remote.js index bdc35c3..4a75363 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -434,11 +434,10 @@ function _connect(state) { } else if (state.handlers.onReconnect && !initialConnect) { state.handlers.onReconnect(); } - intitialConnect = false; + initialConnect = false; } , onClose: function () { - console.log('ON CLOSE'); clearTimeout(timeoutId); wstunneler = null; clientHandlers.closeAll(); @@ -474,17 +473,15 @@ function _connect(state) { state.handlers.onClose() } } - } , onError: function (err) { - console.error("[tunnel error] " + err.message); - console.error(err); - - if (connCallback) { - connCallback(err); + console.error("[tunnel error] " + err.message); + console.error(err); + if (connCallback) { + connCallback(err); + } } - } , sendMessage: function (msg) { if (wstunneler) {