|
|
@@ -456,16 +456,16 @@ export class MTP2WebSocket<T extends Package40 | Package50> {
|
|
|
}
|
|
|
|
|
|
// 开始尝试重连服务端
|
|
|
- if (this.onReconnectChangeState) this.onReconnectChangeState!(this, ReconnectChangeState.BeginReconnect);
|
|
|
+ if (this.onReconnectChangeState) this.onReconnectChangeState(this, ReconnectChangeState.BeginReconnect);
|
|
|
this.conn(this.host)
|
|
|
.then((res) => {
|
|
|
// 连接成功
|
|
|
this.isReconnecting = false;
|
|
|
- if (this.onReconnectChangeState) this.onReconnectChangeState!(this, ReconnectChangeState.ReconnectSuccessed);
|
|
|
+ if (this.onReconnectChangeState) this.onReconnectChangeState(this, ReconnectChangeState.ReconnectSuccessed);
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
// 连接失败
|
|
|
- if (this.onReconnectChangeState) this.onReconnectChangeState!(this, ReconnectChangeState.FailAndWaitPeriod);
|
|
|
+ if (this.onReconnectChangeState) this.onReconnectChangeState(this, ReconnectChangeState.FailAndWaitPeriod);
|
|
|
|
|
|
// 5秒后尝试重连
|
|
|
if (this.reconnectTimer) {
|