mirror of
https://github.com/SuperBFG7/ympd
synced 2024-06-17 10:39:54 +00:00
Fix: show no connection error modal, if app is not initialized
This commit is contained in:
parent
2f3a579d07
commit
597268aca6
|
@ -619,7 +619,7 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Modals -->
|
<!-- Modals -->
|
||||||
<div class="modal fade" id="modalAppInit" tabindex="-1">
|
<div class="modal" id="modalAppInit" tabindex="-1">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header bg-success text-light">
|
<div class="modal-header bg-success text-light">
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ function webSocketConnect() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
socket.onopen = function() {
|
socket.onopen = function() {
|
||||||
console.log('connected');
|
console.log('Websocket is connected');
|
||||||
showNotification('Connected to myMPD: ' + wsUrl, '', '', 'success');
|
showNotification('Connected to myMPD: ' + wsUrl, '', '', 'success');
|
||||||
modalConnectionError.hide();
|
modalConnectionError.hide();
|
||||||
appRoute();
|
appRoute();
|
||||||
|
@ -1111,11 +1111,14 @@ function webSocketConnect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.onclose = function(){
|
socket.onclose = function(){
|
||||||
|
console.log('Websocket is disconnected');
|
||||||
|
if (websocketConnected == true) {
|
||||||
|
//Show modal only if websocket was already connected before
|
||||||
|
modalConnectionError.show();
|
||||||
|
}
|
||||||
websocketConnected = false;
|
websocketConnected = false;
|
||||||
console.log('disconnected');
|
|
||||||
modalConnectionError.show();
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
console.log('reconnect');
|
console.log('Reconnecting websocket');
|
||||||
webSocketConnect();
|
webSocketConnect();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user