From 0f8484de29a420979601326eacd9dac9ab1ebf54 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Fri, 22 Mar 2019 09:46:46 +0800 Subject: [PATCH] =?UTF-8?q?[websocket][=E6=96=B0=E5=A2=9E]:=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pages/index/index.js b/pages/index/index.js index de68c92..55089f5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -197,6 +197,14 @@ Page({ app.globalData.openId = res.data.openId; // 初始化websocket app.initSocket(); + // 回调发送给自己的消息 + app.globalData.socketReceiver = function(e) { + let msgList = that.data.msgList + msgList.push(e) + that.setData({ + msgList: msgList + }) + } Http.setToken(res.data.token); if (options&&(options.couponChannelId || options.orderId)){ that.checkuerstatus(options);