Added support for onOpen/onClose/onDisconnect/onReconnect handlers
This commit is contained in:
parent
7d1c553149
commit
9dccf5b022
|
@ -434,11 +434,10 @@ function _connect(state) {
|
||||||
} else if (state.handlers.onReconnect && !initialConnect) {
|
} else if (state.handlers.onReconnect && !initialConnect) {
|
||||||
state.handlers.onReconnect();
|
state.handlers.onReconnect();
|
||||||
}
|
}
|
||||||
intitialConnect = false;
|
initialConnect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
, onClose: function () {
|
, onClose: function () {
|
||||||
console.log('ON CLOSE');
|
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
wstunneler = null;
|
wstunneler = null;
|
||||||
clientHandlers.closeAll();
|
clientHandlers.closeAll();
|
||||||
|
@ -474,13 +473,11 @@ function _connect(state) {
|
||||||
state.handlers.onClose()
|
state.handlers.onClose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
, onError: function (err) {
|
, onError: function (err) {
|
||||||
console.error("[tunnel error] " + err.message);
|
console.error("[tunnel error] " + err.message);
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
if (connCallback) {
|
if (connCallback) {
|
||||||
connCallback(err);
|
connCallback(err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue