|
|
@ -31,7 +31,7 @@ define([
|
|
|
|
var debug = function (x) { console.log(x); },
|
|
|
|
var debug = function (x) { console.log(x); },
|
|
|
|
warn = function (x) { console.error(x); },
|
|
|
|
warn = function (x) { console.error(x); },
|
|
|
|
verbose = function (x) { console.log(x); };
|
|
|
|
verbose = function (x) { console.log(x); };
|
|
|
|
// verbose = function () {}; // comment out to enable verbose logging
|
|
|
|
verbose = function () {}; // comment out to enable verbose logging
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------ Trapping Keyboard Events ---------------------- //
|
|
|
|
// ------------------ Trapping Keyboard Events ---------------------- //
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +130,7 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Check the connection to the channel
|
|
|
|
// Check the connection to the channel
|
|
|
|
//checkConnection(wc);
|
|
|
|
checkConnection(wc);
|
|
|
|
|
|
|
|
|
|
|
|
bindAllEvents(textarea, doc, onEvent, false);
|
|
|
|
bindAllEvents(textarea, doc, onEvent, false);
|
|
|
|
|
|
|
|
|
|
|
@ -202,9 +202,12 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var checkConnection = function(wc) {
|
|
|
|
var checkConnection = function(wc) {
|
|
|
|
//TODO
|
|
|
|
if(wc.channels && wc.channels.size > 0) {
|
|
|
|
/*var socketChecker = setInterval(function () {
|
|
|
|
var channels = Array.from(wc.channels);
|
|
|
|
if (netflux.checkSocket(realtime)) {
|
|
|
|
var channel = channels[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var socketChecker = setInterval(function () {
|
|
|
|
|
|
|
|
if (channel.checkSocket(realtime)) {
|
|
|
|
warn("Socket disconnected!");
|
|
|
|
warn("Socket disconnected!");
|
|
|
|
|
|
|
|
|
|
|
|
recoverableErrorCount += 1;
|
|
|
|
recoverableErrorCount += 1;
|
|
|
@ -212,13 +215,10 @@ define([
|
|
|
|
if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
|
|
|
|
if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
|
|
|
|
warn("Giving up!");
|
|
|
|
warn("Giving up!");
|
|
|
|
realtime.abort();
|
|
|
|
realtime.abort();
|
|
|
|
wc.leave()
|
|
|
|
try { channel.close(); } catch (e) { warn(e); }
|
|
|
|
.then(null, function(err) {
|
|
|
|
|
|
|
|
warn(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (config.onAbort) {
|
|
|
|
if (config.onAbort) {
|
|
|
|
config.onAbort({
|
|
|
|
config.onAbort({
|
|
|
|
socket: socket
|
|
|
|
socket: channel
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (socketChecker) { clearInterval(socketChecker); }
|
|
|
|
if (socketChecker) { clearInterval(socketChecker); }
|
|
|
@ -226,7 +226,8 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// it's working as expected, continue
|
|
|
|
// it's working as expected, continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 200);*/
|
|
|
|
}, 200);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|