diff --git a/apps/client/src/network/SocketClient.ts b/apps/client/src/network/SocketClient.ts index 7f0dacb..a87374f 100644 --- a/apps/client/src/network/SocketClient.ts +++ b/apps/client/src/network/SocketClient.ts @@ -11,8 +11,14 @@ public socket: Socket; constructor() { - // Socket.io クライアント接続初期化 - this.socket = io(); + // サーバー(バックエンド)のURLを直接指定する + // 本番環境(Render)のURLを指定することで、プロキシなしで直接通信させます + const SERVER_URL = "https://skillsemiwebgame.onrender.com"; + + this.socket = io(SERVER_URL, { + transports: ["websocket", "polling"], // 接続の安定性を高める + withCredentials: true + }); } /** diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts index 22658e1..977986a 100644 --- a/apps/client/vite.config.ts +++ b/apps/client/vite.config.ts @@ -6,7 +6,7 @@ server: { proxy: { '/socket.io': { - target: 'https://skillsemiwebgame.onrender.com', + target: 'localhost:3000', ws: true, }, },