mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-06-28 07:50:11 +02:00
Fix:Socket reconnection on disconnect, Add:Connection indicator icon showing socket/cellular
This commit is contained in:
parent
e07e7f70d6
commit
cb2aaede67
7 changed files with 95 additions and 21 deletions
|
@ -39,6 +39,7 @@ class ServerSocket extends EventEmitter {
|
|||
|
||||
logout() {
|
||||
if (this.socket) this.socket.disconnect()
|
||||
this.removeListeners()
|
||||
}
|
||||
|
||||
setSocketListeners() {
|
||||
|
@ -54,6 +55,14 @@ class ServerSocket extends EventEmitter {
|
|||
// })
|
||||
}
|
||||
|
||||
removeListeners() {
|
||||
if (!this.socket) return
|
||||
this.socket.removeAllListeners()
|
||||
if (this.socket.io && this.socket.io.removeAllListeners) {
|
||||
this.socket.io.removeAllListeners()
|
||||
}
|
||||
}
|
||||
|
||||
onConnect() {
|
||||
console.log('[SOCKET] Socket Connected ' + this.socket.id)
|
||||
this.connected = true
|
||||
|
@ -67,11 +76,6 @@ class ServerSocket extends EventEmitter {
|
|||
this.connected = false
|
||||
this.$store.commit('setSocketConnected', false)
|
||||
this.emit('connection-update', false)
|
||||
|
||||
this.socket.removeAllListeners()
|
||||
if (this.socket.io && this.socket.io.removeAllListeners) {
|
||||
this.socket.io.removeAllListeners()
|
||||
}
|
||||
}
|
||||
|
||||
onInit(data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue