[*] 信令状态
This commit is contained in:
@@ -137,16 +137,13 @@ const signalChannel = {
|
|||||||
*/
|
*/
|
||||||
async connect(address, reconnection = true) {
|
async connect(address, reconnection = true) {
|
||||||
const me = this;
|
const me = this;
|
||||||
// 直接返回旧的连接
|
|
||||||
if (me.connected()) {
|
if (me.connected()) {
|
||||||
|
this.taoyao.connect = true;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
resolve(me.channel);
|
resolve(me.channel);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
// 关闭旧的无效连接
|
this.taoyao.connect = false;
|
||||||
if(this.channel) {
|
|
||||||
console.debug("关闭旧的信令连接", this.address);
|
|
||||||
this.close();
|
|
||||||
}
|
}
|
||||||
me.address = address;
|
me.address = address;
|
||||||
me.reconnection = reconnection;
|
me.reconnection = reconnection;
|
||||||
|
|||||||
Reference in New Issue
Block a user