From 89f966f80b0c152a96bbe21f80f340b566bb97fb Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Wed, 24 Jul 2024 09:39:52 +0800 Subject: [PATCH] Since the online game is already using the Taobao API, it needs to be adapted by the engine. (#17406) * Revert "Due to the single-instance version of the WebSocket, the onMessage response res contains only one layer of data. For compatibility with the online game, Taobao removed the extra layer of data (#17389)" This reverts commit 2f4e6d3caa93a9035696c4702d8aaf81886f73df. * Since the online game is already using the Taobao API, it needs to be adapted by the engine. --- .../taobao-mini-game/wrapper/builtin/MultiWebSocket.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/minigame/platforms/taobao-mini-game/wrapper/builtin/MultiWebSocket.js b/platforms/minigame/platforms/taobao-mini-game/wrapper/builtin/MultiWebSocket.js index bc2b857335..4be039cacb 100644 --- a/platforms/minigame/platforms/taobao-mini-game/wrapper/builtin/MultiWebSocket.js +++ b/platforms/minigame/platforms/taobao-mini-game/wrapper/builtin/MultiWebSocket.js @@ -42,8 +42,9 @@ export default class MultiWebSocket { socketTask.onMessage((res) => { if (typeof this.onmessage === 'function') { - if (res && res.data && res.isBuffer) { - res.data = _utils.base64ToArrayBuffer(res.data) + if (res && res.data && res.data.data && res.data.isBuffer) { + res.isBuffer = res.data.isBuffer; + res.data = _utils.base64ToArrayBuffer(res.data.data); } this.onmessage(res) }