mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-17 22:46:00 +00:00
Fix: Use dynamic server URL for Socket.io connection (production fix)
This commit is contained in:
@@ -12,9 +12,13 @@ class MultiplayerClient {
|
|||||||
this.selectedBoardSize = 15; // Default board size for multiplayer
|
this.selectedBoardSize = 15; // Default board size for multiplayer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Connect to server
|
// Connect to server
|
||||||
connect() {
|
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
|
// Setup board size selector buttons
|
||||||
document.querySelectorAll('.size-btn-mp').forEach(btn => {
|
document.querySelectorAll('.size-btn-mp').forEach(btn => {
|
||||||
|
|||||||
Reference in New Issue
Block a user