|
@@ -222,16 +222,23 @@
|
|
const messageHandlers = {
|
|
const messageHandlers = {
|
|
connect: () => {
|
|
connect: () => {
|
|
window.socket.emit("handshake", (ok) => {
|
|
window.socket.emit("handshake", (ok) => {
|
|
- if (!ok) window.location.reload();
|
|
|
|
|
|
+ if (!ok) {
|
|
|
|
+ console.log('reloading because handshake failed')
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }
|
|
document.getElementById('popup').style.opacity = 0;
|
|
document.getElementById('popup').style.opacity = 0;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
connect_error: (err) => {
|
|
connect_error: (err) => {
|
|
- if (err.message == 'timeout') window.location.reload(); // see https://github.com/zauberzeug/nicegui/issues/198
|
|
|
|
|
|
+ if (err.message == 'timeout') {
|
|
|
|
+ console.log('reloading because connection time out')
|
|
|
|
+ window.location.reload(); // see https://github.com/zauberzeug/nicegui/issues/198
|
|
|
|
+ }
|
|
},
|
|
},
|
|
try_reconnect: () => {
|
|
try_reconnect: () => {
|
|
const checkAndReload = async () => {
|
|
const checkAndReload = async () => {
|
|
await fetch(window.location.href, { headers: { 'NiceGUI-Check': 'try_reconnect' } });
|
|
await fetch(window.location.href, { headers: { 'NiceGUI-Check': 'try_reconnect' } });
|
|
|
|
+ console.log('reloading because reconnect was requested')
|
|
window.location.reload();
|
|
window.location.reload();
|
|
};
|
|
};
|
|
setInterval(checkAndReload, 500);
|
|
setInterval(checkAndReload, 500);
|