From e99c96340fd25fa85867e5588bf817c4dcf4ddd7 Mon Sep 17 00:00:00 2001 From: Kinsey Van Ost Date: Tue, 5 Sep 2023 16:01:03 -0700 Subject: [PATCH 1/3] Add support for socketio/socket.io-redis-adapter onmessage Handler --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 5751ca4..df16a63 100644 --- a/index.js +++ b/index.js @@ -50,6 +50,11 @@ function isDataValid (decoded) { } } +function decode(buffer) { + const json = String.fromCharCode.apply(null, new Uint8Array(buffer)); + return JSON.parse(json); +} + Decoder.prototype.add = function (obj) { var decoded = JSON.parse(obj); @@ -78,3 +83,4 @@ Decoder.prototype.destroy = function () {}; exports.Encoder = Encoder; exports.Decoder = Decoder; +exports.decode = decode; From 2e543f4c30b62d8de6a9859fe9f82d24a7ec3319 Mon Sep 17 00:00:00 2001 From: Kinsey Van Ost Date: Wed, 6 Sep 2023 10:58:39 -0700 Subject: [PATCH 2/3] Add encode method for json encoding --- index.js | 6 +++++ yarn-error.log | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 yarn-error.log diff --git a/index.js b/index.js index df16a63..eb18c31 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,11 @@ function decode(buffer) { return JSON.parse(json); } +function encode(obj) { + const json = JSON.stringify(obj); + return Buffer.from(json); +} + Decoder.prototype.add = function (obj) { var decoded = JSON.parse(obj); @@ -84,3 +89,4 @@ Decoder.prototype.destroy = function () {}; exports.Encoder = Encoder; exports.Decoder = Decoder; exports.decode = decode; +exports.encode = encode; diff --git a/yarn-error.log b/yarn-error.log new file mode 100644 index 0000000..694f13a --- /dev/null +++ b/yarn-error.log @@ -0,0 +1,68 @@ +Arguments: + /Users/vanost/.nvm/versions/node/v16.14.2/bin/node /Users/vanost/.node/corepack/yarn/1.22.15/bin/yarn.js add @meue/rsmq@0.12.0 + +PATH: + /Users/vanost/.nvm/versions/node/v16.14.2/bin:/Users/vanost/.nvm/versions/node/v18.16.0/bin:/Users/vanost/.nvm/versions/node/v18.16.0/bin:/Users/vanost/.nvm/versions/node/v18.17.1/bin:/Users/vanost/.nvm/versions/node/v18.17.1/bin:/Users/vanost/.nvm/versions/node/v16.14.2/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/vanost/.nvm/versions/node/v16.14.2/bin:/opt/homebrew/bin:/opt/homebrew/sbin + +Yarn version: + 1.22.15 + +Node version: + 16.14.2 + +Platform: + darwin arm64 + +Trace: + Error: https://registry.yarnpkg.com/@meue%2frsmq: Not found + at Request.params.callback [as _callback] (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:66140:18) + at Request.self.callback (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:140885:22) + at Request.emit (node:events:526:28) + at Request. (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:141857:10) + at Request.emit (node:events:526:28) + at IncomingMessage. (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:141779:12) + at Object.onceWrapper (node:events:645:28) + at IncomingMessage.emit (node:events:538:35) + at endReadableNT (node:internal/streams/readable:1345:12) + at processTicksAndRejections (node:internal/process/task_queues:83:21) + +npm manifest: + { + "name": "socket.io-json-parser", + "version": "3.0.0", + "description": "socket.io parser based on JSON.stringify / JSON.parse", + "main": "index", + "dependencies": { + "component-emitter": "~1.3.0" + }, + "devDependencies": { + "expect.js": "0.3.1", + "mocha": "3.2.0", + "semistandard": "9.2.1", + "socket.io": "^3.1.2", + "socket.io-client": "^3.1.2" + }, + "scripts": { + "lint": "semistandard", + "test": "npm run lint && mocha test/index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/darrachequesne/socket.io-json-parser.git" + }, + "author": "Damien Arrachequesne", + "license": "MIT", + "bugs": { + "url": "https://github.com/darrachequesne/socket.io-json-parser/issues" + }, + "homepage": "https://github.com/darrachequesne/socket.io-json-parser#readme", + "files": [ + "index.js" + ] + } + +yarn manifest: + No manifest + +Lockfile: + No lockfile From af8b5177e69d829d42be15a0f1e6ea67a59bda3a Mon Sep 17 00:00:00 2001 From: Kinsey Van Ost Date: Wed, 6 Sep 2023 10:59:49 -0700 Subject: [PATCH 3/3] Remove yarn-error.log --- yarn-error.log | 68 -------------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 yarn-error.log diff --git a/yarn-error.log b/yarn-error.log deleted file mode 100644 index 694f13a..0000000 --- a/yarn-error.log +++ /dev/null @@ -1,68 +0,0 @@ -Arguments: - /Users/vanost/.nvm/versions/node/v16.14.2/bin/node /Users/vanost/.node/corepack/yarn/1.22.15/bin/yarn.js add @meue/rsmq@0.12.0 - -PATH: - /Users/vanost/.nvm/versions/node/v16.14.2/bin:/Users/vanost/.nvm/versions/node/v18.16.0/bin:/Users/vanost/.nvm/versions/node/v18.16.0/bin:/Users/vanost/.nvm/versions/node/v18.17.1/bin:/Users/vanost/.nvm/versions/node/v18.17.1/bin:/Users/vanost/.nvm/versions/node/v16.14.2/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/vanost/.nvm/versions/node/v16.14.2/bin:/opt/homebrew/bin:/opt/homebrew/sbin - -Yarn version: - 1.22.15 - -Node version: - 16.14.2 - -Platform: - darwin arm64 - -Trace: - Error: https://registry.yarnpkg.com/@meue%2frsmq: Not found - at Request.params.callback [as _callback] (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:66140:18) - at Request.self.callback (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:140885:22) - at Request.emit (node:events:526:28) - at Request. (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:141857:10) - at Request.emit (node:events:526:28) - at IncomingMessage. (/Users/vanost/.node/corepack/yarn/1.22.15/lib/cli.js:141779:12) - at Object.onceWrapper (node:events:645:28) - at IncomingMessage.emit (node:events:538:35) - at endReadableNT (node:internal/streams/readable:1345:12) - at processTicksAndRejections (node:internal/process/task_queues:83:21) - -npm manifest: - { - "name": "socket.io-json-parser", - "version": "3.0.0", - "description": "socket.io parser based on JSON.stringify / JSON.parse", - "main": "index", - "dependencies": { - "component-emitter": "~1.3.0" - }, - "devDependencies": { - "expect.js": "0.3.1", - "mocha": "3.2.0", - "semistandard": "9.2.1", - "socket.io": "^3.1.2", - "socket.io-client": "^3.1.2" - }, - "scripts": { - "lint": "semistandard", - "test": "npm run lint && mocha test/index.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/darrachequesne/socket.io-json-parser.git" - }, - "author": "Damien Arrachequesne", - "license": "MIT", - "bugs": { - "url": "https://github.com/darrachequesne/socket.io-json-parser/issues" - }, - "homepage": "https://github.com/darrachequesne/socket.io-json-parser#readme", - "files": [ - "index.js" - ] - } - -yarn manifest: - No manifest - -Lockfile: - No lockfile