Add socket.io-parser dependency and refactor StringIdParser
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good

- Added `socket.io-parser` as a dependency in both `package.json` and `bun.lock`.
- Refactored `StringIdParser` to utilize the `Encoder` and `Decoder` from `socket.io-parser`, improving the handling of socket communications.
This commit is contained in:
Tom Butcher 2026-11-08 20:18:02 +00:00
parent bf9ce2da9b
commit 11ebc0d66c
3 changed files with 3 additions and 6 deletions

View File

@ -22,6 +22,7 @@
"node-thermal-printer": "^4.6.0",
"socket.io": "^4.8.3",
"socket.io-client": "^4.8.3",
"socket.io-parser": "^4.2.6",
"ws": "^8.20.1",
},
"devDependencies": {

View File

@ -34,6 +34,7 @@
"node-thermal-printer": "^4.6.0",
"socket.io": "^4.8.3",
"socket.io-client": "^4.8.3",
"socket.io-parser": "^4.2.6",
"ws": "^8.20.1"
},
"devDependencies": {

View File

@ -1,11 +1,6 @@
import { createRequire } from "node:module";
import { Decoder, Encoder } from "socket.io-parser";
import { stringifyIds } from "../objectid.js";
const require = createRequire(import.meta.url);
const { Encoder, Decoder } = createRequire(require.resolve("socket.io-client"))(
"socket.io-parser",
);
class StringIdEncoder extends Encoder {
encode(packet) {
if (packet?.data == null) return super.encode(packet);