fix and update

This commit is contained in:
lendry
2026-06-30 23:18:53 +03:00
parent 6ee3ffe0a5
commit 4b2ade9354
6 changed files with 17 additions and 41 deletions

View File

@@ -2,7 +2,7 @@
import * as React from 'react';
import { useAuth } from '@/components/id/auth-provider';
import { ensureApiGatewayReady, fetchUnreadNotificationCount, getWsUrl, type ChatMessage } from '@/lib/api';
import { fetchUnreadNotificationCount, getWsUrl, type ChatMessage } from '@/lib/api';
import { dispatchAvatarUpdated, dispatchChatRoomAvatarUpdated } from '@/lib/avatar-events';
const WS_RECONNECT_BASE_MS = 2_000;
@@ -90,13 +90,6 @@ export function RealtimeProvider({ children }: { children: React.ReactNode }) {
}
async function connect() {
if (cancelled) return;
try {
await ensureApiGatewayReady();
} catch {
scheduleReconnect();
return;
}
if (cancelled) return;
const url = `${getWsUrl()}?token=${encodeURIComponent(token!)}`;
const socket = new WebSocket(url);