mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-07 04:18:48 +02:00
Fix:Socket reconnection on disconnect, Add:Connection indicator icon showing socket/cellular
This commit is contained in:
+9
-5
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user