update signalR.js
This commit is contained in:
parent
f525400a45
commit
aed71615d5
@ -15,7 +15,7 @@ export default {
|
|||||||
const connection = new signalR.HubConnectionBuilder()
|
const connection = new signalR.HubConnectionBuilder()
|
||||||
.withUrl(socketUrl, { accessTokenFactory: () => getToken() })
|
.withUrl(socketUrl, { accessTokenFactory: () => getToken() })
|
||||||
.withAutomaticReconnect() //自动重新连接
|
.withAutomaticReconnect() //自动重新连接
|
||||||
.configureLogging(signalR.LogLevel.Information)
|
.configureLogging(signalR.LogLevel.Warning)
|
||||||
.build();
|
.build();
|
||||||
this.SR = connection
|
this.SR = connection
|
||||||
// 断线重连
|
// 断线重连
|
||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
//使用async和await 或 promise的then 和catch 处理来自服务端的异常
|
//使用async和await 或 promise的then 和catch 处理来自服务端的异常
|
||||||
await this.SR.start()
|
await this.SR.start()
|
||||||
//console.assert(this.SR.state === signalR.HubConnectionState.Connected);
|
//console.assert(this.SR.state === signalR.HubConnectionState.Connected);
|
||||||
console.log('signalR 连接成功了', this.SR.state);
|
console.log('signalR', this.SR.state);
|
||||||
return true
|
return true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
that.failNum--;
|
that.failNum--;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user