diff --git a/src/socket.mjs b/src/socket.mjs index a9add86..81a99f0 100644 --- a/src/socket.mjs +++ b/src/socket.mjs @@ -86,9 +86,8 @@ export default class Socket extends Server { // TODO need to start error listener for stream so errors can be processed stream.on('message', messageProcess.bind(this)) async function messageProcess (packet) { - let res = clone(packet) - // console.log(' incoming packet on socket side',packet) - res = clone((await this._packetProcess(res)),false) + //console.log(' incoming packet on socket side',packet) + let res = await this._packetProcess(clone(packet)) if (Object.keys(res).length === 0) res = { error: 'socket packet command function likely did not return a promise', packet:packet} res._header = clone(packet._header,false) //make sure return packet has header with id in case it was removed in processing delete packet._header // remove before adding to response header as request