请问解决了吗
小程序使用UDPSocket监听机器端数据,监听不到是怎么回事?https://developers.weixin.qq.com/miniprogram/dev/framework/
2021-02-06请问解决了吗
为什么UDP在IOS系统下需要打开调试模式才能正常收发数据,体验版不行?在使用udp功能的时候发现UDP通信在IOS系统下需要打开调试模式才能正常收发数据,而体验版不能发送数据。 我又换了安卓系统来测试也存在这个情况。 请问这个是什么情况,又遇到过这种问题的朋友嘛? 希望官方解答一下谢谢。 IOS:苹果8 (IOS 11.3.1) 安卓:华为MATE20 (安卓9.0) 代码如下: [代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码])[代码][代码]var[代码] [代码]udpSocket = wx.createUDPSocket();[代码][代码]var[代码] [代码]locationPort = udpSocket.bind();[代码] [代码]Page({[代码][代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面的初始数据[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]messageList: [][代码][代码] [代码][代码]},[代码][代码] [代码][代码]mydata: {[代码][代码] [代码][代码]message: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]remoteUrl: {[代码][代码] [代码][代码]ip: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]port: -1[代码][代码] [代码][代码]},[代码][代码] [代码][代码]isSend: [代码][代码]false[代码][代码] [代码][代码]},[代码][代码] [代码][代码]addMessage(event) {[代码][代码] [代码][代码]console.log(event)[代码][代码] [代码][代码]this[代码][代码].mydata.message = event.detail.value[代码][代码] [代码][代码]},[代码][代码] [代码][代码]sendMessage() {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].mydata.isSend) {[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].mydata.isSend = [代码][代码]true[代码][代码] [代码][代码]let ip = [代码][代码]this[代码][代码].mydata.remoteUrl.ip[代码][代码] [代码][代码]let port = [代码][代码]this[代码][代码].mydata.remoteUrl.port[代码][代码] [代码][代码]let message = [代码][代码]this[代码][代码].mydata.message[代码][代码] [代码][代码]if[代码] [代码](message.trim() === [代码][代码]''[代码][代码]) {[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'请输入内容'[代码][代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]udpSocket.send({[代码][代码] [代码][代码]address: ip,[代码][代码] [代码][代码]port: port,[代码][代码] [代码][代码]message: message[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].mydata.isSend = [代码][代码]false[代码][代码] [代码][代码]let list = [代码][代码]this[代码][代码].data.messageList[代码][代码] [代码][代码]let obj = {[代码][代码] [代码][代码]text: message,[代码][代码] [代码][代码]from: 2[代码][代码] [代码][代码]}[代码][代码] [代码][代码]list.push(obj)[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]messageList: list[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]initUdpSocket() {[代码] [代码] [代码][代码]if[代码] [代码](udpSocket === [代码][代码]null[代码][代码]) {[代码][代码] [代码][代码]console.log([代码][代码]'暂不支持'[代码][代码])[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]'locationUrl.port'[代码][代码]: locationPort[代码][代码] [代码][代码]})[代码][代码] [代码][代码]udpSocket.onListening([代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'监听中...'[代码][代码])[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码] [代码][代码]udpSocket.onMessage([代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(res.message)[代码][代码] [代码][代码]let str = util.newAb2Str(res.message)[代码][代码] [代码][代码]console.log([代码][代码]'str==='[代码] [代码]+ str)[代码][代码] [代码][代码]let list = that.data.messageList[代码][代码] [代码][代码]let obj = {[代码][代码] [代码][代码]text: str,[代码][代码] [代码][代码]from: 1[代码][代码] [代码][代码]}[代码][代码] [代码][代码]list.push(obj)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]messageList: list[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]/**[代码][代码] [代码][代码]* 输入ip/端口号[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]addIp: [代码][代码]function[代码] [代码](event) {[代码][代码] [代码][代码]this[代码][代码].mydata.remoteUrl.ip = event.detail.value[代码][代码] [代码][代码]},[代码][代码] [代码][代码]addPort: [代码][代码]function[代码] [代码](event) {[代码][代码] [代码][代码]this[代码][代码].mydata.remoteUrl.port = event.detail.value[代码][代码] [代码][代码]}[代码][代码]})[代码]
2020-12-22请问解决了吗
UDPSocket.onMessage IOS系统收不到硬件返回的消息,是什么原因?udpSocket.bind(8888) UDPSocket.onMessage IOS系统通过指定的硬件设备ip加端口能发送出去消息,硬件设备也能收到消息,但收不到硬件设备返回的消息,Andriod系统和硬件设备可以相互通讯,是什么原因 sendMessage(){ if (this.mydata.isSend){ return ; } const udpSocket = wx.createUDPSocket() this.mydata.isSend = true const that = this; let ip = this.mydata.remoteUrl.ip let port = this.mydata.remoteUrl.port let message = this.mydata.message if(message.trim() === ''){ wx.showToast({ title: '请输入内容', }) return ; } udpSocket.bind() udpSocket.send({ address: '192.168.4.1', port:'1000', message: message, }) this.mydata.isSend = false let list = this.data.messageList let obj = { text: message, from : 2 } list.push(obj) this.setData({ messageList : list }) }, onLoad: function (options) { var that = this; this.initUdpSocket() that.getConnectedWifi(); }, initUdpSocket(){ const udpSocket = wx.createUDPSocket(); if(udpSocket === null){ console.log('暂不支持') return ; } udpSocket.bind(8888) udpSocket.onListening(function(res){ console.log('监听中...') console.log(res) }) udpSocket.onMessage(function (res) { console.log('ddddd',res) }) },
2020-12-22请问下,解决了吗,我现在调用发放代金券的接口提示商户号与appid不匹配,该怎么解决呢(我已经在微信支付授权了对应的小程序appid了)
发放代金券API接口,怎么跟小程序打通当用户点击小程序前端的领取按钮,然后获取微信商户侧发放的代金券,这个流程该怎么实现呢?红色框内的内容?[图片]
2020-05-07这个发送模板消息要在后端处理吗。小程序不能发送是吗
模板消息问题[图片] 小程序发送模板消息时。报错没有添加合法域名。 [图片] 在后台添加又添加不了这个域名。这个要怎么解决?
2018-05-18