From 21fd5c123e6faf94be1416478a916a661296f84d Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Mon, 15 Jun 2026 17:53:16 +0330 Subject: [PATCH] fix(signalr): skip negotiate, connect WebSockets-only (CDN 404s the POST) WCDN rejects the SignalR negotiate POST (404, wcdn-nfc-reason: Http_Method), so the hub never connects and online matchmaking never starts. Connect directly via WebSockets with skipNegotiation so there's no negotiate POST; the JWT rides the ?access_token query the server already accepts for /hub. The proper fix remains bypassing the CDN for api.bargevasat.ir. Co-Authored-By: Claude Opus 4.8 --- src/lib/online/signalr-service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/online/signalr-service.ts b/src/lib/online/signalr-service.ts index ddc738b..70add24 100644 --- a/src/lib/online/signalr-service.ts +++ b/src/lib/online/signalr-service.ts @@ -141,7 +141,15 @@ export class SignalrService implements OnlineService { private async connect(): Promise { if (this.conn || !this.token) return; const conn = new signalR.HubConnectionBuilder() - .withUrl(`${SERVER}/hub/game`, { accessTokenFactory: () => this.token ?? "" }) + // 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, + }) .withAutomaticReconnect() .configureLogging(signalR.LogLevel.Warning) .build();