|
|
@ -46,9 +46,10 @@ class SocketConnection extends EventEmitter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// async start(token) {
|
|
|
|
async start(token) {
|
|
|
|
// // 组件重新加载时, 如果 socket 存在, 不需要新建
|
|
|
|
// 组件重新加载时, 如果 socket 存在, 不需要新建
|
|
|
|
// if (!this.socket) {
|
|
|
|
if (!this.socket) {
|
|
|
|
|
|
|
|
console.log(this.socket)
|
|
|
|
// this.socket = new SignalR.HubConnectionBuilder()
|
|
|
|
// this.socket = new SignalR.HubConnectionBuilder()
|
|
|
|
// .configureLogging(SignalR.LogLevel.Information)
|
|
|
|
// .configureLogging(SignalR.LogLevel.Information)
|
|
|
|
// .withUrl(
|
|
|
|
// .withUrl(
|
|
|
@ -59,32 +60,31 @@ class SocketConnection extends EventEmitter {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// .build()
|
|
|
|
// .build()
|
|
|
|
|
|
|
|
this.socket.on('ForceExist', () => {
|
|
|
|
// this.socket.on('ForceExist', () => { //可以做相关业务逻辑
|
|
|
|
//可以做相关业务逻辑
|
|
|
|
// store.dispatch("Logout").then(()=>{
|
|
|
|
store
|
|
|
|
// window.location.reload()
|
|
|
|
.dispatch('Logout')
|
|
|
|
// }).catch(err=>{
|
|
|
|
.then(() => {
|
|
|
|
// this.$message.error({
|
|
|
|
window.location.reload()
|
|
|
|
// title: '错误',
|
|
|
|
})
|
|
|
|
// description: err.message
|
|
|
|
.catch(err => {
|
|
|
|
// })
|
|
|
|
this.$message.error({
|
|
|
|
// })
|
|
|
|
title: '错误',
|
|
|
|
// })
|
|
|
|
description: err.message
|
|
|
|
|
|
|
|
})
|
|
|
|
// this.socket.on('AppendNotice', (notice) => {
|
|
|
|
})
|
|
|
|
// store.commit("APPEND_NOTICE",notice)
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
this.socket.on('AppendNotice', notice => {
|
|
|
|
|
|
|
|
store.commit('APPEND_NOTICE', notice)
|
|
|
|
// this.socket.onclose(async () => {
|
|
|
|
})
|
|
|
|
// this.offline = true
|
|
|
|
this.socket.onclose(async () => {
|
|
|
|
// this.emit('onclose')
|
|
|
|
this.offline = true
|
|
|
|
// await this._initialize()
|
|
|
|
this.emit('onclose')
|
|
|
|
// })
|
|
|
|
await this._initialize()
|
|
|
|
|
|
|
|
})
|
|
|
|
// await this._initialize()
|
|
|
|
await this._initialize()
|
|
|
|
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async authenticate(token) {
|
|
|
|
async authenticate(token) {
|
|
|
|
await this.start(token)
|
|
|
|
await this.start(token)
|
|
|
|