diff --git a/src/websocket/custom/getZip.js b/src/websocket/custom/getZip.js index b8ce7d4..b3498ba 100644 --- a/src/websocket/custom/getZip.js +++ b/src/websocket/custom/getZip.js @@ -72,7 +72,7 @@ const handleZip = (id, ws) => { module.exports = { action: "/custom/getZip", execute: (ws, request) => { - const {id, cid} = request.params + const {id, cid} = request if (cid) { controller.abort() controller = new AbortController() diff --git a/src/websocket/index.js b/src/websocket/index.js index 290a06e..ed58891 100644 --- a/src/websocket/index.js +++ b/src/websocket/index.js @@ -18,8 +18,9 @@ module.exports = { actions[ws.action] = ws.execute } }).then(() => ws.on('message', res => { - if (res?.action) { - actions[res.action]?.(ws, JSON.parse(res)) + if (res?.data) { + const data = JSON.parse(res.data) + !!data?.action && actions[res.action]?.(ws, data) } })) })