Ability to reconnect after a connection failure
This commit is contained in:
parent
5a3da11c40
commit
c168ce2d1c
@ -224,10 +224,11 @@ define([
|
|||||||
return {
|
return {
|
||||||
failed: function () {
|
failed: function () {
|
||||||
connected = false;
|
connected = false;
|
||||||
userListElement.textContent = '';
|
userListElement.textContent = 'Disconnected';
|
||||||
lagElement.textContent = '';
|
lagElement.textContent = '';
|
||||||
},
|
},
|
||||||
reconnecting: function () {
|
reconnecting: function (userId) {
|
||||||
|
myUserName = userId;
|
||||||
connected = false;
|
connected = false;
|
||||||
userListElement.textContent = Messages.reconnecting;
|
userListElement.textContent = Messages.reconnecting;
|
||||||
lagElement.textContent = '';
|
lagElement.textContent = '';
|
||||||
|
|||||||
@ -603,6 +603,18 @@ define([
|
|||||||
Cryptpad.alert(Messages.disconnectAlert);
|
Cryptpad.alert(Messages.disconnectAlert);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onConnectionChange = realtimeOptions.onConnectionChange = function (info) {
|
||||||
|
setEditable(info.state);
|
||||||
|
toolbar.failed();
|
||||||
|
if (info.state) {
|
||||||
|
initializing = true;
|
||||||
|
toolbar.reconnecting(info.myId);
|
||||||
|
Cryptpad.findOKButton().click();
|
||||||
|
} else {
|
||||||
|
Cryptpad.alert(Messages.disconnectAlert);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var onLocal = realtimeOptions.onLocal = function () {
|
var onLocal = realtimeOptions.onLocal = function () {
|
||||||
if (initializing) { return; }
|
if (initializing) { return; }
|
||||||
|
|
||||||
|
|||||||
@ -74,10 +74,19 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var onAbort = config.onAbort = function (info) {
|
var onAbort = config.onAbort = function (info) {
|
||||||
$textarea.attr('disabled', true);
|
setEditable(false);
|
||||||
window.alert("Server Connection Lost");
|
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);
|
var rt = Realtime.start(config);
|
||||||
|
|
||||||
['cut', 'paste', 'change', 'keyup', 'keydown', 'select', 'textInput']
|
['cut', 'paste', 'change', 'keyup', 'keydown', 'select', 'textInput']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user