Skip to content
Snippets Groups Projects
Commit d1f1dc39 authored by 석찬 윤's avatar 석찬 윤
Browse files

Merge branch 'develop' of https://git.ajou.ac.kr/websystem1/webfront into develop

parents 29da67d6 529a4ff6
Branches
No related tags found
1 merge request!39[refactor] 웹소켓 연결 경로 env 처리
Pipeline #10980 passed
......@@ -7,6 +7,9 @@ import Button from "../components/Button";
import ChattingNoticeDetailModal from '../components/ChattingNoticeDetailModal';
import ChattingNoticeListModal from '../components/ChattingNoticeListModal';
// 웹소켓 서버 연결 URL
const WS_URL = process.env.REACT_APP_WS_URL;
// 흔들리는 애니메이션을 위한 keyframes 정의
const shakeAnimation = keyframes`
0% { transform: translateY(0); }
......@@ -435,7 +438,7 @@ function ChattingDetail() {
ws.current.close(); // 기존 WebSocket 연결 종료
}
ws.current = new WebSocket('ws://localhost:8081');
ws.current = new WebSocket(WS_URL);
ws.current.onopen = () => {
if (ws.current.isTimedOut) {
console.log(`타임아웃된 클라이언트의 재연결을 차단: ${nickname}`);
......
......@@ -2,6 +2,9 @@ import React, { useState, useEffect, useRef, useCallback } from "react";
import { useNavigate } from "react-router-dom";
import useAuthStore from "../store/authStore";
// 웹소켓 서버 연결 URL
const WS_URL = process.env.REACT_APP_WS_URL;
function ChattingList() {
const [rooms, setRooms] = useState([]);
const [joinedRooms, setJoinedRooms] = useState([]);
......@@ -13,7 +16,7 @@ function ChattingList() {
// WebSocket 연결 및 실시간 업데이트
const setupWebSocket = () => {
ws.current = new WebSocket('ws://localhost:8081'); // WebSocket 연결
ws.current = new WebSocket(WS_URL); // WebSocket 연결
ws.current.onopen = () => {
console.log('WebSocket 연결 성공');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment