1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-10-26 03:17:40 +00:00

Fix: show no connection error modal, if app is not initialized

This commit is contained in:
jcorporation
2019-01-14 23:13:57 +00:00
parent 2f3a579d07
commit 597268aca6
2 changed files with 8 additions and 5 deletions

View File

@@ -1048,7 +1048,7 @@ function webSocketConnect() {
try {
socket.onopen = function() {
console.log('connected');
console.log('Websocket is connected');
showNotification('Connected to myMPD: ' + wsUrl, '', '', 'success');
modalConnectionError.hide();
appRoute();
@@ -1111,11 +1111,14 @@ function webSocketConnect() {
}
socket.onclose = function(){
console.log('Websocket is disconnected');
if (websocketConnected == true) {
//Show modal only if websocket was already connected before
modalConnectionError.show();
}
websocketConnected = false;
console.log('disconnected');
modalConnectionError.show();
setTimeout(function() {
console.log('reconnect');
console.log('Reconnecting websocket');
webSocketConnect();
}, 3000);
}