liuyg
2022-02-22 6fcfc6ac30b67bcf081e5739364623ece7482909
store/lid/websocketL.js
@@ -21,6 +21,7 @@
}
Wst.prototype.$callBack = function(getValue, getState, getws, ids) {
   // console.log("设置回调函数")
   this.backValue = function(res) {
      if (!getValue && !getState) {
         console.log(res, "未设置msg返回函数");
@@ -39,6 +40,7 @@
};
Wst.prototype.$connect = function(Data) {
   // console.log("开启")
   this.ourControl = true;
   let that = this;
   this.Data = Data;
@@ -50,12 +52,14 @@
   this.ws = uni.connectSocket({
      url: that.url,
      success(data) {
         // console.log(data, "websocket连接成功");
         console.log(data, "websocket连接成功");
      },
   });
   // console.log(that.url)
   this.ws.onOpen((res) => {
      // 注:只有连接正常打开中 ,才能正常成功发送消息
      // console.log("发送登入消息 websocket")
      // console.log(that.loginData)
      that.ws.send({
         data: JSON.stringify(that.loginData),
         async success(res) {