Skip to content

Commit 055c51a

Browse files
hamlsyclaude
andcommitted
fix: 로비/게임 WebSocket URL 중복 경로(/ws/ws) 문제 수정
VUE_APP_WS_URL에 이미 /ws가 포함되어 있는데 endpoint를 추가로 붙여 /ws/ws로 중복 요청이 발생하던 문제 수정. resolveSockJsUrl()로 통일하여 notification/friendWebSocket과 동일한 URL 구성 방식 사용. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b513e25 commit 055c51a

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

  • src/features/game/multiplayer/shared/services/websocket/composables

src/features/game/multiplayer/shared/services/websocket/composables/core.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ref, readonly } from "vue";
22
import SockJS from "sockjs-client";
33
import { Stomp } from "@stomp/stompjs";
4+
import { resolveSockJsUrl } from "@/core/platform/websocketUrl.js";
45

56
/**
67
* WebSocket 코어 기능
@@ -71,25 +72,9 @@ const connect = (endpoint = "/ws", onConnectCallback = null) => {
7172

7273
try {
7374
// WebSocket URL 구성
74-
let wsUrl;
75-
// endpoint 정규화: 항상 "/"로 시작
76-
const normalizedEndpoint = endpoint?.startsWith("/")
77-
? endpoint
78-
: `/${endpoint || ""}`;
79-
75+
const wsUrl = resolveSockJsUrl();
8076
if (isDevelopment) {
81-
// 개발 환경: localhost:8080 사용
82-
wsUrl = `${process.env.VUE_APP_WS_URL}${endpoint}`;
83-
log("🔵 개발 환경 WebSocket URL:", wsUrl);
84-
log(process.env.VUE_APP_WS_URL);
85-
} else {
86-
// 프로덕션 환경: 환경 변수 또는 현재 호스트 사용
87-
if (process.env.VUE_APP_WS_URL) {
88-
wsUrl = `${process.env.VUE_APP_WS_URL}${endpoint}`;
89-
} else {
90-
// 환경 변수가 없으면 현재 페이지의 호스트 사용
91-
wsUrl = `${window.location.protocol}//${window.location.host}${normalizedEndpoint}`;
92-
}
77+
log("🔵 WebSocket URL:", wsUrl);
9378
}
9479

9580

0 commit comments

Comments
 (0)