Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#27] FCM을 이용한 Push 알림 서버 구현 #28

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kohseongyeon
Copy link
Member

@kohseongyeon kohseongyeon commented Aug 26, 2021

FCM을 이용한 Push Notification Server를 구축하였습니다.

  • push-notification-api 모듈 생성
  • Firebase로부터 FCM 이용 권한이 부여된 AccessToken 가져오기 (FCM에 Push 요청 보낼 시, Header에 설정하여 인증을 위해 사용)
  • FCM에서 수신하는 형식에 맞추어 Request 작성 (+PushNotificationMessage)
  • FCM에 Push 알림 요청을 보내기 위한 HTTP POST Request 생성

@kohseongyeon kohseongyeon self-assigned this Aug 26, 2021
@kohseongyeon kohseongyeon linked an issue Aug 26, 2021 that may be closed by this pull request
3 tasks
Comment on lines +8 to +9
@Getter
@AllArgsConstructor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 두개는 @Value 하나로 관리할 수 있을것 같습니다

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 Value 사용하게되면 필드에 명시한 private 도 생략가능할것 같습니다.
(default 로 private final 데이터가 유지되므로)

@Builder
@Getter
@AllArgsConstructor
public static class Notification {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotificationPushNotificationMessage 가 포함하고 있는게 맞나요??
포함관계라면 PushNotificationMessage 내부에서 필드 추가해줘야할것 같습니다.

Notification notification;

아니라면 Notification 은 다른 클래스로 빼주는게 자연스러울것 같아요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotificationMessage의 필드로 사용되는 클래스입니다!
Message 클래스 내부에 포함되도록 변경하면 될까요?

Comment on lines +21 to +23
private static final String FIREBASE_CONFIG_PATH = "firebase/firebase_service_key.json"; // TODO : add firebase project service key file
private static final String API_URL = "https://fcm.googleapis.com/v1/projects/{firebase-project-id}/messages:send";
private static final String OAUTH_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

급한건 아니지만 이런것들은 yml 설정파일에 넣어주는 편이 좋을것 같습니다

PushNotificationMessage.Notification.builder()
.title(title)
.body(body)
.image(null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 null 은 임시방편인가요?? 아님 항상 null 인건가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

임시방편으로 null 값을 넣어놨습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FCM Push 알림 서버 구축
2 participants