From 471e0658955633847c7a78fdb6d9e311e6ee7317 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=8B=AC=EC=9E=AC=EC=97=BD?= <jysim0326@ajou.ac.kr>
Date: Mon, 9 Dec 2024 16:45:59 +0900
Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=9B=B9=EC=86=8C=EC=BC=93=20?=
 =?UTF-8?q?=EA=B0=9D=EC=B2=B4=20=EC=97=B0=EA=B2=B0=20=ED=97=A4=EB=8D=94=20?=
 =?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/ChattingList.jsx | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/components/ChattingList.jsx b/src/components/ChattingList.jsx
index 2b278ff..7304639 100644
--- a/src/components/ChattingList.jsx
+++ b/src/components/ChattingList.jsx
@@ -16,7 +16,14 @@ function ChattingList() {
 
   // WebSocket 연결 및 실시간 업데이트
   const setupWebSocket = () => {
-    ws.current = new WebSocket(WS_URL); // WebSocket 연결
+    console.log("연결하는 url", WS_URL);
+    // ws.current = new WebSocket(WS_URL); // WebSocket 연결
+    ws.current = new WebSocket(WS_URL, [], {
+      headers: {
+        "Access-Control-Allow-Credentials": "true",
+        "Access-Control-Allow-Origin": `${process.env.REACT_APP_BASE_URL}`,
+      },
+    });
 
     ws.current.onopen = () => {
       console.log('WebSocket 연결 성공');
@@ -58,6 +65,10 @@ function ChattingList() {
 
     ws.current.onerror = (error) => {
       console.error('WebSocket 오류:', error);
+
+      if (error.target) {
+        console.error("WebSocket 오류 대상:", error.target);
+      }
     };
   };
 
-- 
GitLab