Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use newer reconnecting websocket and reconnect when page receives focus #1446

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"mdi": "^2.2.43",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"reconnectingwebsocket": "^1.0.0",
"reconnecting-websocket": "^4.4.0",
"spotify-web-api-js": "^1.5.2",
"string-to-color": "^2.2.2",
"vue": "^3.2.31",
Expand Down
8 changes: 5 additions & 3 deletions web-src/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import ModalDialogRemotePairing from '@/components/ModalDialogRemotePairing.vue'
import ModalDialogUpdate from '@/components/ModalDialogUpdate.vue'
import webapi from '@/webapi'
import * as types from '@/store/mutation_types'
import ReconnectingWebSocket from 'reconnectingwebsocket'
import ReconnectingWebSocket from 'reconnecting-websocket'
import moment from 'moment'

export default {
Expand Down Expand Up @@ -180,8 +180,8 @@ export default {
}

const socket = new ReconnectingWebSocket(wsUrl, 'notify', {
reconnectInterval: 1000,
maxReconnectInterval: 2000
minReconnectionDelay: 1000,
maxReconnectionDelay: 2000
})

socket.onopen = function () {
Expand Down Expand Up @@ -246,6 +246,8 @@ export default {
return
}

socket.reconnect()

vm.update_outputs()
vm.update_player_status()
vm.update_library_stats()
Expand Down