diff --git a/backend/src/main/java/com/ody/notification/service/FcmPushSender.java b/backend/src/main/java/com/ody/notification/service/FcmPushSender.java index b1be0a0d8..7db301b7b 100644 --- a/backend/src/main/java/com/ody/notification/service/FcmPushSender.java +++ b/backend/src/main/java/com/ody/notification/service/FcmPushSender.java @@ -4,6 +4,7 @@ import com.google.firebase.messaging.FirebaseMessagingException; import com.google.firebase.messaging.Message; import com.ody.common.exception.OdyServerErrorException; +import com.ody.notification.dto.request.EnterMessageRequest; import com.ody.notification.dto.request.FcmSendRequest; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -13,8 +14,9 @@ public class FcmPushSender { public String sendPushNotification(FcmSendRequest fcmSendRequest) { + Message message = Message.builder() - .setTopic(fcmSendRequest.topic()) + .setTopic("/topics/" + fcmSendRequest.topic()) .putData("type", fcmSendRequest.notificationType().name()) .putData("nickname", fcmSendRequest.nickname()) .build(); diff --git a/backend/src/main/java/com/ody/notification/service/FcmSubscriber.java b/backend/src/main/java/com/ody/notification/service/FcmSubscriber.java index 6126997b5..dc56f0dbe 100644 --- a/backend/src/main/java/com/ody/notification/service/FcmSubscriber.java +++ b/backend/src/main/java/com/ody/notification/service/FcmSubscriber.java @@ -15,8 +15,9 @@ public class FcmSubscriber { public void subscribeTopic(Meeting meeting, DeviceToken deviceToken) { try { + String topicName = "/topics/" + meeting.getId().toString(); TopicManagementResponse topicManagementResponse = FirebaseMessaging.getInstance() - .subscribeToTopic(List.of(deviceToken.getDeviceToken()), meeting.getId().toString()); + .subscribeToTopic(List.of(deviceToken.getDeviceToken()), topicName); log.info("모임 구독에 성공했습니다 {}", topicManagementResponse); } catch (Exception exception) { log.error(exception.getMessage());