diff --git a/packages/frontend/src/pages/stock-detail/ChatPanel.tsx b/packages/frontend/src/pages/stock-detail/ChatPanel.tsx index 9b91ebe3..fd48594f 100644 --- a/packages/frontend/src/pages/stock-detail/ChatPanel.tsx +++ b/packages/frontend/src/pages/stock-detail/ChatPanel.tsx @@ -24,9 +24,7 @@ export const ChatPanel = () => { useEffect(() => { const handleChat = (message: ChatDataResponse) => { - console.log('Received message:', message); if (message?.chats) { - console.log('Chats:', message.chats); setChatData(message.chats); } }; @@ -38,7 +36,7 @@ export const ChatPanel = () => { socketChat.off('chat', handleChat); }; } - }, [socketChat, isConnected]); + }, []); return (
diff --git a/packages/frontend/src/sockets/config.ts b/packages/frontend/src/sockets/config.ts index 67cdd3be..3f6b29e5 100644 --- a/packages/frontend/src/sockets/config.ts +++ b/packages/frontend/src/sockets/config.ts @@ -8,14 +8,13 @@ export interface SocketChatType { } export const socketChat = ({ stockId, pageSize = 20 }: SocketChatType) => { - return io(`${URL}/api/chat/realtime`, { - transports: ['websocket'], - reconnectionDelayMax: 10000, - query: { - stockId, - pageSize, + return io( + `${URL}/api/chat/realtime?stockId=${stockId}&pageSize=${pageSize}`, + { + transports: ['websocket'], + reconnectionDelayMax: 10000, }, - }); + ); }; export const socketStock = io(`${URL}/api/stock/realtime`, {