sendSocketMessage下图手机上函数没有执行,请问下原因
报错如下
wx.sendSocketMessage的值 function (){try{return e.apply(e,arguments)}catch(e){if("[object Error]"===Object.prototype.toString.apply(e)){if("AppServiceSdkKnownError"==e.type)throw e;Reporter.errorReport({key:"appServiceSDKScriptError",error:e,extend:t})}}} |
第二个框
在手机上,这个函数没有执行
我一个手机调试模式出的信息是 wx.sendSocketMessage的值 和电脑上一样,一个手机出的信息是null
appservice这样写的
//跳转聊天室 chatRoom: function (e){ var userid=e.currentTarget.dataset.userid; var name=e.currentTarget.dataset.name; var avatar=e.currentTarget.dataset.avatar; wx.navigateTo({ url: '../chatRoom/chatRoom?u=' + userid + '&n=' + encodeURIComponent(name) + '&a=' + avatar }); }, }) function sendSocketMessage(msg) { if (socketOpen) { console.log( 'wx.sendSocketMessage的类型 ' + typeof wx.sendSocketMessage) console.log( 'wx.sendSocketMessage的值 ' + wx.sendSocketMessage) wx.sendSocketMessage({ data:msg, success: function (data){ //console.log(data); } }) } else { console.log( "请先建立连接" ) } } |