const webSocketModule = require('../../modules/WebSocketModule.js')
websocketModule.subject(data=>{
console.log("index:"+JSON.stringify(data))
});
let arr=new Array()
function subject(callback){
arr.push(callback);
}
function release(msg){
arr.map(data => {
data(msg)
})
}
wx.onSocketMessage(function (res) {
let data=JSON.parse(res.data)
release(data)
})
module.exports = {
subject: subject
}
说到乱怼,我是服我自己的