diff --git a/src/lib/online/signalr-service.ts b/src/lib/online/signalr-service.ts index 70add24..88c78cb 100644 --- a/src/lib/online/signalr-service.ts +++ b/src/lib/online/signalr-service.ts @@ -141,15 +141,10 @@ export class SignalrService implements OnlineService { private async connect(): Promise { if (this.conn || !this.token) return; const conn = new signalR.HubConnectionBuilder() - // Connect straight over WebSockets and SKIP the negotiate POST — some CDNs - // (WCDN) 404 the negotiate POST by method. The JWT rides the WS query - // string (server reads ?access_token for /hub). Real fix is to bypass the - // CDN for api.bargevasat.ir; this is a best-effort fallback. - .withUrl(`${SERVER}/hub/game`, { - accessTokenFactory: () => this.token ?? "", - skipNegotiation: true, - transport: signalR.HttpTransportType.WebSockets, - }) + // Normal negotiate flow → auto-picks the best transport (WS, else SSE / + // long-poll). Requires api.bargevasat.ir to BYPASS the CDN (WCDN 404s the + // negotiate POST); with the CDN bypassed this is the most robust path. + .withUrl(`${SERVER}/hub/game`, { accessTokenFactory: () => this.token ?? "" }) .withAutomaticReconnect() .configureLogging(signalR.LogLevel.Warning) .build();