From 858a5e52d440a6e2f9f522b024e7d4f45a91a609 Mon Sep 17 00:00:00 2001 From: DeNNiiInc Date: Sat, 13 Dec 2025 19:21:10 +1100 Subject: [PATCH] Fix: Use dynamic server URL for Socket.io connection (production fix) --- multiplayer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/multiplayer.js b/multiplayer.js index 08557f0..31dcdd9 100644 --- a/multiplayer.js +++ b/multiplayer.js @@ -12,9 +12,13 @@ class MultiplayerClient { this.selectedBoardSize = 15; // Default board size for multiplayer } + // Connect to server connect() { - this.socket = io('http://localhost:3000'); + // Automatically detect server URL (works for both local and production) + const serverUrl = window.location.origin; + console.log('Connecting to server:', serverUrl); + this.socket = io(serverUrl); // Setup board size selector buttons document.querySelectorAll('.size-btn-mp').forEach(btn => {