mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-25 02:20:27 +00:00
Fixed reconnecting to myMPD
This commit is contained in:
parent
577bc7843e
commit
7b3b7bd7d1
@ -249,6 +249,19 @@
|
||||
</nav>
|
||||
</footer>
|
||||
|
||||
<div class="modal" id="modalConnectionError" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><span class="material-icons">error</span> Connection Error</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Connection to myMPD failed. Trying to reconnect.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="settings" tabindex="-1" role="dialog" aria-labelledby="settingsLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
@ -158,7 +158,7 @@ $(document).ready(function(){
|
||||
$('#mainMenu').on('shown.bs.dropdown', function () {
|
||||
$('#search > input').val('');
|
||||
$('#search > input').focus();
|
||||
})
|
||||
});
|
||||
|
||||
if(!notificationsSupported())
|
||||
$('#btnnotifyWeb').addClass("disabled");
|
||||
@ -183,7 +183,7 @@ function webSocketConnect() {
|
||||
socket.onopen = function() {
|
||||
console.log("connected");
|
||||
showNotification('Connected to myMPD','','','success');
|
||||
|
||||
$('#modalConnectionError').modal('hide');
|
||||
app.run();
|
||||
/* emit initial request for output names */
|
||||
socket.send('MPD_API_GET_OUTPUTS');
|
||||
@ -548,6 +548,7 @@ function webSocketConnect() {
|
||||
break;
|
||||
case 'disconnected':
|
||||
showNotification('myMPD lost connection to MPD','','','danger');
|
||||
|
||||
break;
|
||||
case 'update_queue':
|
||||
if(current_app === 'queue') {
|
||||
@ -568,8 +569,12 @@ function webSocketConnect() {
|
||||
}
|
||||
|
||||
socket.onclose = function(){
|
||||
console.log("disconnected");
|
||||
showNotification('Connection to myMPD lost, retrying in 3 seconds','','','danger');
|
||||
console.log('disconnected');
|
||||
$('#modalConnectionError').modal('show');
|
||||
setTimeout(function() {
|
||||
console.log('reconnect');
|
||||
webSocketConnect();
|
||||
},3000);
|
||||
}
|
||||
|
||||
} catch(exception) {
|
||||
|
Loading…
Reference in New Issue
Block a user