|
@@ -142,9 +142,7 @@ export default {
|
142
|
142
|
console.log(this.websockets)
|
143
|
143
|
this.needReload = false
|
144
|
144
|
Object.keys(this.websockets).forEach((key) => {
|
145
|
|
- console.log(key, this.websockets[key])
|
146
|
|
- this.websockets[key].close()
|
147
|
|
- clearInterval(this.websockets[key].interval)
|
|
145
|
+ this.destroyWebsocket(this.websockets[key])
|
148
|
146
|
})
|
149
|
147
|
this.websockets = {}
|
150
|
148
|
next()
|
|
@@ -153,8 +151,7 @@ export default {
|
153
|
151
|
init () {
|
154
|
152
|
this.needReload = false
|
155
|
153
|
Object.keys(this.websockets).forEach((key) => {
|
156
|
|
- console.log(key, this.websockets[key])
|
157
|
|
- this.websockets[key].close()
|
|
154
|
+ this.destroyWebsocket(this.websockets[key])
|
158
|
155
|
})
|
159
|
156
|
this.websockets = {}
|
160
|
157
|
this.needReload = true
|
|
@@ -311,6 +308,7 @@ export default {
|
311
|
308
|
},
|
312
|
309
|
newWebsocket (wsRealPath) {
|
313
|
310
|
const ws = this.websockets[wsRealPath]
|
|
311
|
+ console.log('newWebsocket', ws)
|
314
|
312
|
if (!ws) {
|
315
|
313
|
const url = `${window.location.origin.replace('http', 'ws')}${wsRealPath}?token=${localStorage.getItem('JWT')}`
|
316
|
314
|
this.websockets[wsRealPath] = new WebSocket(url)
|
|
@@ -338,6 +336,14 @@ export default {
|
338
|
336
|
}, 5000)
|
339
|
337
|
}
|
340
|
338
|
},
|
|
339
|
+ destroyWebsocket (ws) {
|
|
340
|
+ ws.onclose = ((ws) => {
|
|
341
|
+ console.log('close')
|
|
342
|
+ })(ws)
|
|
343
|
+ ws.close()
|
|
344
|
+ clearInterval(ws.interval)
|
|
345
|
+ ws = null
|
|
346
|
+ },
|
341
|
347
|
open () {
|
342
|
348
|
if (!this.CaseId) {
|
343
|
349
|
this.$message({
|