diff --git a/client/src/services/gameClient.ts b/client/src/services/gameClient.ts index d259cb8..5d7fc4e 100644 --- a/client/src/services/gameClient.ts +++ b/client/src/services/gameClient.ts @@ -29,7 +29,14 @@ export class GameClient { // Fetch runtime configuration from our Express server const configResponse = await fetch('/api/config') const config = await configResponse.json() - const serverUrl = config.serverUrl || 'ws://localhost:2567' + let serverUrl = config.serverUrl || 'ws://localhost:2567' + + // Convert HTTP/HTTPS URLs to WebSocket URLs + if (serverUrl.startsWith('https://')) { + serverUrl = serverUrl.replace('https://', 'wss://') + } else if (serverUrl.startsWith('http://')) { + serverUrl = serverUrl.replace('http://', 'ws://') + } this.client = new Client(serverUrl) logger.info('Game client initialized with server:', serverUrl) diff --git a/docker-compose.yml b/docker-compose.yml index b28f4fc..4115fca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: environment: - NODE_ENV=production - PORT=3000 - - SERVER_URL=http://snatchGameServer.interno.com + - SERVER_URL=https://snatchGameServer.interno.com depends_on: - snatchgame-server networks: @@ -53,7 +53,7 @@ services: environment: - NODE_ENV=production - PORT=3001 - - SERVER_URL=http://snatchGameServer.interno.com + - SERVER_URL=https://snatchGameServer.interno.com depends_on: - snatchgame-server networks: