diff --git a/socket.js b/socket.js index f8a9547..30bd418 100644 --- a/socket.js +++ b/socket.js @@ -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 }; @@ -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'); }