Connect over polling first so the game still works when a proxy drops the
websocket upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 17:15:47 +02:00
co-authored by Claude Opus 5.5
parent 037b98f5e1
commit d1a9c7d0f7
7 changed files with 24 additions and 14 deletions
+3 -1
View File
@@ -2,7 +2,9 @@ import { io } from 'socket.io-client';
import type { JoinAck } from '@two-keys/shared';
import { pushToast } from './toasts';
export const socket = io({ transports: ['websocket', 'polling'] });
// Polling first, then upgrade: a websocket-first client never falls back, so a proxy that
// drops the Upgrade header would leave it unable to connect at all.
export const socket = io();
socket.on('toast', ({ message }: { message: string }) => pushToast(message));
socket.on('error', ({ message }: { message: string }) => pushToast(message, 'error'));