| | |
| | | } |
| | | |
| | | Wst.prototype.$callBack = function(getValue, getState, getws, ids) { |
| | | // console.log("设置回调函数") |
| | | this.backValue = function(res) { |
| | | if (!getValue && !getState) { |
| | | console.log(res, "未设置msg返回函数"); |
| | |
| | | }; |
| | | |
| | | Wst.prototype.$connect = function(Data) { |
| | | // console.log("开启") |
| | | this.ourControl = true; |
| | | let that = this; |
| | | this.Data = Data; |
| | |
| | | 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) { |