Skip to content

Commit

Permalink
[feat]: 메시지 보낼때 roomId 정보 전송 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Gseungmin committed Aug 22, 2023
1 parent c081211 commit 94458a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ const getFcm = async (otherId) => {
}
};

const sendNotificationToToken = async (fcmToken, title, body) => {
const sendNotificationToToken = async (fcmToken, title, body, roomId) => {
const message = {
notification: {
title: title,
body: body
},
data: {
roomId: roomId
},
token: fcmToken
};

Expand Down Expand Up @@ -105,7 +108,7 @@ module.exports = (io) => {
const { otherFcm } = await getFcm(otherId); //fcm 토큰 정보 받아오기

if (otherFcm) {
await sendNotificationToToken(otherFcm, userId, newMessage.content);
await sendNotificationToToken(otherFcm, userId, newMessage.content, roomId);
} else {
console.error('No valid FCM token available');
}
Expand Down

0 comments on commit 94458a3

Please sign in to comment.