- We分析中实时日志能导出excel吗?
如题,在网页上查看,无法对键值对进行搜索
2023-12-13 - 安卓无法建立 websocket
ios端没有任何问题,能建立 websocket 连接,安卓端就会反复中断,其他 http 接口是没有问题,就是无法建立 websocket 连接 [图片] export function initSocket() { let retryNum = 3 let heartbeatTimer = null const role = 'customer' return new Promise((resovle, reject) => { getRoomID({ role: role }).then((res) => { // res.data.roomID getApp().globalData.curRoomID = res.data.roomID const conn = wx.connectSocket({ url: 'wss://' + res.data.targetHost + 'ws/' + res.data.roomID, header: { 'content-type': 'application/json', role: role, token: getToken() }, timeout: 5, success(res) { console.log('websocket connection is established!') }, fail(err) { console.log(' wx.connectSocket err') console.log(err) if (retryNum > 0) { buryPointPackage(initSocket, 'ws://' + res.data.targetWebsocketUrl, err, 0, { 'content-type': 'application/json', role: role, token: getToken() }) retryNum = retryNum - 1 initSocket() } else { reject() } } }) heartbeatTimer = setInterval(() => { conn.send({ data: JSON.stringify({ action: 'heartbeat', timestamp: Math.floor((Math.round(new Date()) / 1000)) }), }) }, 5000) conn.onOpen(() => { const roomID = res.data.roomID // 请求未读消息数量 getUnreadMsgNum(roomID, conn) // 获取未读消息数量 conn.onMessage((res) => { const data = JSON.parse(res.data) if (data.action === 'pullTheNumberOfUnreadMessagesAck') { setUnreadMsgNum(data.data.numberOfUnreadMessages) // 如果globalMenu已经初始化,就可以调用设置 if (getApp().globalData.globalMenu) getApp().globalData .globalMenu.setUnreadMsgNum() } else if (data.action === 'noticeMessageToBePulled') { getUnreadMsgNum(roomID, conn) } }) resovle({ conn: conn, socketHost: res.data.targetHost }) }) conn.onClose(() => { console.log('conn.onClose') clearInterval(heartbeatTimer) }) conn.onError((err) => { console.log(' onError err') console.log(err) clearInterval(heartbeatTimer) }) }) }) }
2023-11-24