Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/socket/handlers/task.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,18 @@ export const setupTaskHandlers = (io, socket) => {
const { taskId, subTaskId, content } = payload;
const userId = socket.user.id;

//로그 확인----
const numericTaskId = Number(taskId);
const numericSubTaskId = Number(subTaskId);
const roomName = `task:${numericTaskId}`;

console.log("===================================");
console.log("[comment:create 요청 수신]");
console.log("userId:", userId);
console.log("taskId:", numericTaskId);
console.log("subTaskId:", numericSubTaskId);
console.log("===================================");
//------
console.log(`[SOCKET][comment:create] 요청 수신`, { userId, taskId, subTaskId, content });

// Service 호출
Expand All @@ -395,6 +407,13 @@ export const setupTaskHandlers = (io, socket) => {
content: content,
});

const clients = io.sockets.adapter.rooms.get(roomName);
console.log("[emit 정보]");
console.log("taskId:", roomName);
console.log("인원:", clients ? clients.size : 0);
console.log("commentId:", newComment.id);
console.log("===================================");

// 같은 Task 방에 있는 사람들에게 알림
io.to(`task:${taskId}`).emit(commentEvents.CREATED_COMMENT, {
taskId: Number(taskId),
Expand Down