This commit is contained in:
Henry Jameson 2026-09-01 18:36:57 +03:00
commit c8593a9668

View file

@ -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