Ability to reconnect after a connection failure

This commit is contained in:
yflory
2016-08-25 17:56:17 +02:00
parent 5a3da11c40
commit c168ce2d1c
3 changed files with 25 additions and 3 deletions

View File

@@ -74,10 +74,19 @@ define([
};
var onAbort = config.onAbort = function (info) {
$textarea.attr('disabled', true);
setEditable(false);
window.alert("Server Connection Lost");
};
var onConnectionChange = config.onConnectionChange = function (info) {
if (info.state) {
initializing = true;
} else {
setEditable(false);
window.alert("Server Connection Lost. Trying to reconnect...");
}
};
var rt = Realtime.start(config);
['cut', 'paste', 'change', 'keyup', 'keydown', 'select', 'textInput']