mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-11-27 18:52:45 +01:00
Fix:Socket reconnection on disconnect, Add:Connection indicator icon showing socket/cellular
This commit is contained in:
1 parent
e07e7f70d6
commit
cb2aaede67
7 files changed
+95
-21
No files matched your search
+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