提交websocket
This commit is contained in:
@@ -19,7 +19,7 @@ class webSocketUtils {
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('catch');
|
||||
// this.reconnect();
|
||||
this.reconnect();
|
||||
}
|
||||
}
|
||||
// 进入这个页面的时候创建websocket连接【整个页面随时使用】
|
||||
@@ -48,7 +48,7 @@ class webSocketUtils {
|
||||
clearInterval(this.heartbeatInterval);
|
||||
this.is_open_socket = true;
|
||||
this.canReconnect = true;
|
||||
// this.start();
|
||||
this.start();
|
||||
// 注:只有连接正常打开中 ,才能正常收到消息
|
||||
this.socketTask.onMessage((e) => {
|
||||
// 字符串转json
|
||||
@@ -71,7 +71,7 @@ class webSocketUtils {
|
||||
title: `网络连接失败,正尝试第${this.connectNum}次连接`,
|
||||
icon: 'none',
|
||||
});
|
||||
// this.reconnect();
|
||||
this.reconnect();
|
||||
this.connectNum += 1;
|
||||
} else {
|
||||
// uni.$emit('connectError');
|
||||
@@ -91,7 +91,7 @@ class webSocketUtils {
|
||||
|
||||
this.is_open_socket = false;
|
||||
if (this.canReconnect) {
|
||||
// this.reconnect();
|
||||
this.reconnect();
|
||||
this.canReconnect = false;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user