Skip to content
Snippets Groups Projects
Commit 471e0658 authored by 심재엽's avatar 심재엽
Browse files

refactor: 웹소켓 객체 연결 헤더 추가

parent 552991be
No related branches found
No related tags found
1 merge request!42[refactor] 웹소켓 객체 연결 헤더 추가
Pipeline #10987 passed
...@@ -16,7 +16,14 @@ function ChattingList() { ...@@ -16,7 +16,14 @@ function ChattingList() {
// WebSocket 연결 및 실시간 업데이트 // WebSocket 연결 및 실시간 업데이트
const setupWebSocket = () => { 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 = () => { ws.current.onopen = () => {
console.log('WebSocket 연결 성공'); console.log('WebSocket 연결 성공');
...@@ -58,6 +65,10 @@ function ChattingList() { ...@@ -58,6 +65,10 @@ function ChattingList() {
ws.current.onerror = (error) => { ws.current.onerror = (error) => {
console.error('WebSocket 오류:', error); console.error('WebSocket 오류:', error);
if (error.target) {
console.error("WebSocket 오류 대상:", error.target);
}
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment