P3
This commit is contained in:
parent
7b037ef60f
commit
c8593a9668
1 changed files with 10 additions and 2 deletions
|
|
@ -108,7 +108,14 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
}
|
||||
},
|
||||
initSocket(initial) {
|
||||
if (this.socket) throw new Error('Socket already exists!')
|
||||
if (this.socket) {
|
||||
console.error("Socket already exists! This shouldn't happen! Force-closing the socket just in case")
|
||||
try {
|
||||
this.socket.close()
|
||||
} catch (e) {
|
||||
console.error("Error closing existing socket that shouldn't be there. Welp. Moving on.", e)
|
||||
}
|
||||
}
|
||||
|
||||
this.state = initial
|
||||
? WSConnectionStatus.STARTING_INITIAL
|
||||
|
|
@ -130,7 +137,8 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
this.socket.addEventListener('error', this.onError)
|
||||
},
|
||||
stopSocket() {
|
||||
this.socket.close()
|
||||
if (this.socket == null) console.error("Socket is already stopped! This shouldn't happen!")
|
||||
this.socket?.close()
|
||||
this.socket = null
|
||||
this.state = WSConnectionStatus.CLOSED
|
||||
this.retrying = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue