mirror of
https://github.com/zadam/trilium.git
synced 2024-09-21 08:06:03 +08:00
sync WS message is now kind of ping - if there's no ping from server we display error message
This commit is contained in:
parent
8766e9ae4a
commit
3e6acb17cc
|
@ -152,6 +152,7 @@ ws.onmessage = function (event) {
|
|||
const message = JSON.parse(event.data);
|
||||
|
||||
if (message.type === 'sync') {
|
||||
lastPingTs = new Date().getTime();
|
||||
const data = message.data;
|
||||
|
||||
if (data.notes_tree) {
|
||||
|
@ -169,4 +170,12 @@ ws.onmessage = function (event) {
|
|||
const changesToPushCountEl = $("#changesToPushCount");
|
||||
changesToPushCountEl.html(message.changesToPushCount);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
let lastPingTs = new Date().getTime();
|
||||
|
||||
setInterval(() => {
|
||||
if (new Date().getTime() - lastPingTs > 5000) {
|
||||
showError("No communication with server");
|
||||
}
|
||||
}, 3000);
|
Loading…
Reference in a new issue