Fix: Use dynamic server URL for Socket.io connection (production fix)

This commit is contained in:
2025-12-13 19:21:10 +11:00
parent c4b5473586
commit 858a5e52d4

View File

@@ -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 => {