From a71f00e629210de643d8c608a926436fff632468 Mon Sep 17 00:00:00 2001 From: Adam Weeks Date: Fri, 12 Dec 2025 11:52:49 -0500 Subject: [PATCH 1/2] Fix Socket.IO connection: Add polling fallback and reconnection logic - Change from WebSocket-only to WebSocket with polling fallback - Add reconnection configuration for better resilience - Fixes real-time updates not appearing across users --- frontend/src/context/LobbyProvider.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/context/LobbyProvider.jsx b/frontend/src/context/LobbyProvider.jsx index 7b23a0a..137e0af 100644 --- a/frontend/src/context/LobbyProvider.jsx +++ b/frontend/src/context/LobbyProvider.jsx @@ -20,7 +20,12 @@ export const LobbyProvider = ({ lobbyId, initialUser, children }) => { }); const socket = useMemo( - () => io(import.meta.env.VITE_SOCKET_URL, { transports: ['websocket'] }), + () => io(import.meta.env.VITE_SOCKET_URL, { + transports: ['websocket', 'polling'], + reconnection: true, + reconnectionDelay: 1000, + reconnectionAttempts: 5 + }), [], ); From dcd9b4fea3d53b1bad428f4698f6b1f3e95790ce Mon Sep 17 00:00:00 2001 From: Adam Weeks Date: Fri, 12 Dec 2025 11:56:54 -0500 Subject: [PATCH 2/2] Fix prettier formatting for Socket.IO config --- frontend/src/context/LobbyProvider.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/src/context/LobbyProvider.jsx b/frontend/src/context/LobbyProvider.jsx index 137e0af..692afe4 100644 --- a/frontend/src/context/LobbyProvider.jsx +++ b/frontend/src/context/LobbyProvider.jsx @@ -20,12 +20,13 @@ export const LobbyProvider = ({ lobbyId, initialUser, children }) => { }); const socket = useMemo( - () => io(import.meta.env.VITE_SOCKET_URL, { - transports: ['websocket', 'polling'], - reconnection: true, - reconnectionDelay: 1000, - reconnectionAttempts: 5 - }), + () => + io(import.meta.env.VITE_SOCKET_URL, { + transports: ['websocket', 'polling'], + reconnection: true, + reconnectionDelay: 1000, + reconnectionAttempts: 5, + }), [], );