Skip to content

Commit

Permalink
Bug - 웹소켓 stockId를 넘기지 못하는 문제 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
baegyeong authored Nov 21, 2024
2 parents 07b1a4c + 9d292df commit a1712f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions packages/frontend/src/pages/stock-detail/ChatPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand All @@ -38,7 +36,7 @@ export const ChatPanel = () => {
socketChat.off('chat', handleChat);
};
}
}, [socketChat, isConnected]);
}, []);

return (
<article className="flex flex-col gap-5 rounded-md bg-white p-7">
Expand Down
13 changes: 6 additions & 7 deletions packages/frontend/src/sockets/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`, {
Expand Down

0 comments on commit a1712f0

Please sign in to comment.