From bbcf1d742d1eda532800a6c3f3f570520fc1ec86 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 9 Mar 2026 03:45:02 -0700 Subject: [PATCH] fix(feishu): WSClient appId + EventDispatcher pattern Co-Authored-By: Claude Sonnet 4.6 --- .../src/infrastructure/feishu/feishu-router.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts b/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts index 818f981..33cae26 100644 --- a/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts +++ b/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts @@ -127,12 +127,12 @@ export class FeishuRouterService implements OnModuleInit, OnModuleDestroy { // WebSocket long-connection client — SDK handles auth, reconnect, ping/pong, ACK this.wsClient = new lark.WSClient({ - appID: this.appId, + appId: this.appId, appSecret: this.appSecret, loggerLevel: lark.LoggerLevel.warn, }); - this.wsClient.start({ + const dispatcher = new lark.EventDispatcher({}).register({ 'im.message.receive_v1': async (data: any) => { try { await this.handleIncomingEvent(data); @@ -142,6 +142,8 @@ export class FeishuRouterService implements OnModuleInit, OnModuleDestroy { }, }); + this.wsClient.start({ eventDispatcher: dispatcher }); + this.cleanupTimer = setInterval(() => this.periodicCleanup(), CLEANUP_INTERVAL_MS); if (this.cleanupTimer.unref) this.cleanupTimer.unref();