Commit b9ad850ac1c60b1b1b54fcb8e52f65f1a8d5b0ea

Authored by ww
1 parent f38bc97b

fix: subscribe value same on different page bind same device

@@ -12808,7 +12808,7 @@ class Ws { @@ -12808,7 +12808,7 @@ class Ws {
12808 * @description 发送消息 12808 * @description 发送消息
12809 */ 12809 */
12810 send(message) { 12810 send(message) {
12811 - if (this.ws.readyState !== 1) { 12811 + if (!this.ws || this.ws.readyState !== 1) {
12812 this.errorStack.push(message) 12812 this.errorStack.push(message)
12813 return 12813 return
12814 } 12814 }
@@ -12839,6 +12839,7 @@ class Ws { @@ -12839,6 +12839,7 @@ class Ws {
12839 this.close() 12839 this.close()
12840 this.ws = null 12840 this.ws = null
12841 this.errorStack = null 12841 this.errorStack = null
  12842 + Ws.instance = null
12842 } 12843 }
12843 12844
12844 /** 12845 /**
@@ -13027,6 +13028,7 @@ class DispatchCenter { @@ -13027,6 +13028,7 @@ class DispatchCenter {
13027 * @description 建立socket连接 13028 * @description 建立socket连接
13028 */ 13029 */
13029 connectSocket() { 13030 connectSocket() {
  13031 + Ws.instance?.destroy?.()
13030 this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnmessage }) 13032 this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnmessage })
13031 } 13033 }
13032 13034
@@ -13068,9 +13070,6 @@ class DispatchCenter { @@ -13068,9 +13070,6 @@ class DispatchCenter {
13068 if (!id) return 13070 if (!id) return
13069 const [err, res] = await to(ConfigurationNodeApi.getConfigurationInfo('CONTENT', id)) 13071 const [err, res] = await to(ConfigurationNodeApi.getConfigurationInfo('CONTENT', id))
13070 this.contentData = res 13072 this.contentData = res
13071 - // const { dataSources } = this.contentData = res  
13072 - // const tsSubCmds = this.generatorDataSourceMapping(dataSources)  
13073 - // this.sendMessageToGetRealTimeData({ tsSubCmds })  
13074 } 13073 }
13075 13074
13076 /** 13075 /**