diff --git a/frontend/app/ui/room/chat-room.tsx b/frontend/app/ui/room/chat-room.tsx index 236df9d1..bb72fc83 100644 --- a/frontend/app/ui/room/chat-room.tsx +++ b/frontend/app/ui/room/chat-room.tsx @@ -64,7 +64,7 @@ export default function ChatHome({ id, user }: { id: number; user: User }) { console.log("disconnect"); socket.disconnect(); }; - }, []); + }, [id]); const sendMessage = (e: React.SyntheticEvent) => { e.preventDefault(); diff --git a/frontend/socket.ts b/frontend/socket.ts index 70315a6c..f4a06646 100644 --- a/frontend/socket.ts +++ b/frontend/socket.ts @@ -1,4 +1,4 @@ import { io } from "socket.io-client"; -export const socket = io("http://" + `${process.env.NEXT_PUBLIC_WEB_URL}`, { +export const socket = io(`${process.env.NEXT_PUBLIC_WEB_URL}`, { autoConnect: false, });