From 61184d1e599495fa3374769a3140d02f5f0c61a0 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 2 Jun 2024 18:43:09 +0800 Subject: [PATCH] fix: fix a problem which make disableMsgpack not work --- server/mixins/socketio.mixin.ts | 7 ++++++- server/services/core/gateway.service.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/mixins/socketio.mixin.ts b/server/mixins/socketio.mixin.ts index 71725da0e18..ba3dbb60f9f 100644 --- a/server/mixins/socketio.mixin.ts +++ b/server/mixins/socketio.mixin.ts @@ -59,6 +59,11 @@ interface TcSocketIOServiceOptions { * 用户token校验 */ userAuth: (token: string) => Promise; + + /** + * 是否禁用msgpack + */ + disableMsgpack?: boolean; } /** @@ -541,7 +546,7 @@ export const TcSocketIOService = ( origin: '*', methods: ['GET', 'POST'], }, - parser: msgpackParser, + parser: options.disableMsgpack ? undefined : msgpackParser, }); if ( diff --git a/server/services/core/gateway.service.ts b/server/services/core/gateway.service.ts index c17072945c1..8f329fa74c9 100644 --- a/server/services/core/gateway.service.ts +++ b/server/services/core/gateway.service.ts @@ -42,6 +42,7 @@ export default class ApiService extends TcService { return user; }, + disableMsgpack: config.feature.disableMsgpack, }) ); this.registerMixin(TcHealth());