feat(gateway): add websocket pong timeout and channel auto-reconnect watchdog (#569)

This commit is contained in:
paisley
2026-03-18 13:25:30 +08:00
committed by GitHub
Unverified
parent 554f894493
commit 1eda50ef44
4 changed files with 102 additions and 7 deletions

View File

@@ -269,7 +269,14 @@ export const useGatewayStore = create<GatewayState>((set, get) => ({
const state = useChannelsStore.getState();
const channel = state.channels.find((item) => item.type === update.channelId);
if (channel) {
state.updateChannel(channel.id, { status: mapChannelStatus(update.status) });
const newStatus = mapChannelStatus(update.status);
state.updateChannel(channel.id, { status: newStatus });
if (newStatus === 'disconnected' || newStatus === 'error') {
state.scheduleAutoReconnect(channel.id);
} else if (newStatus === 'connected' || newStatus === 'connecting') {
state.clearAutoReconnect(channel.id);
}
}
})
.catch(() => {});