Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/channels/feishu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ export class FeishuAdapter implements ChannelAdapter {
this.wsClient = new lark.WSClient({
...baseConfig,
loggerLevel: lark.LoggerLevel.info,
pingTimeout: this.config.pingTimeout ?? 30,
onReady: () => console.log('[feishu] WS ready'),
onReconnecting: () => console.log('[feishu] WS reconnecting...'),
onReconnected: () => console.log('[feishu] WS reconnected'),
onError: (err: unknown) => console.error('[feishu] WS error:', (err as Error)?.message),
});

await this.wsClient.start({ eventDispatcher });
Expand Down Expand Up @@ -635,8 +640,11 @@ export class FeishuAdapter implements ChannelAdapter {
}

async stop(): Promise<void> {
// WSClient doesn't expose a clean close method in current SDK version;
// setting to null allows GC to collect.
if (this.wsClient) {
try {
this.wsClient.close();
} catch {}
}
this.wsClient = null;
this.client = null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface FeishuChannelConfig {
appSecret: string;
/** Open platform domain. Use `lark` for Lark global tenants. Default: `feishu`. */
domain?: string;
/** WebSocket pong timeout in seconds. If no pong received within this time, the connection is considered dead and reconnect is triggered. Default: 30. */
pingTimeout?: number;
}

export interface DingtalkChannelConfig {
Expand Down