-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 앱 내 푸시알림 구현 #274
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
[FEAT] 앱 내 푸시알림 구현 #274
Conversation
- Firebase 서비스 계정 key-file 기반 GoogleCredentials(인증 객체) 생성
- GoogleCredentials(인증 객체) 설정을 통한 Firebase 인증 정보 구성
- GoogleCredentials(인증 객체) 설정을 통한 Firebase 인증 정보 구성
- Spring Bean으로 등록하여 FirebaseMessaging을 의존성 주입할 수 있도록 함 - 서버에서 FCM message를 전송할 수 있는 기반 로직 구현
- 하드 코딩된 ClassPathResource를 주입하여 대체 - Firebase 설정 경로를 yml에서 관리
- platform-specific한 Message 부분 정의
- platform-specific한 Message 부분 정의
- 푸시 알림 발생시키는 액션과 한 트랜잭션에 묶여야 하기 때문에 Async보다는 send로 동기 처리
- FirebaseMessagingException를 try-catch로 잡아서 log 남김
- 예외 처리 범위 명확화 - 가독성 개선
- try-catch로 getInputStream()에서 발생할 수 있는 IOException 잡고, 로깅 및 IllegalStateException throw
- android 프로퍼티 제거 - notification 프로퍼티 제거 - apns 프로퍼티 수정 - data 프로퍼티 추가
- 누락된 ' 추가
- Long userId -> User user
- from sendCommentPushMessage to sendCommentPushMessageToFeedOwner
- FirebaseMessagingException를 try-catch로 잡아서 log 남김
- 중복된 파라미터 간소화 - 정적 팩터리 메서드 of 추가
ChaeAg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
궁금한 점 코멘트 남겨요 ~!
푸시 알림 구현 정말 수고 많으셨습니다!! 🙏🙏
src/main/java/org/websoso/WSSServer/service/PopularFeedService.java
Outdated
Show resolved
Hide resolved
ChaeAg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
본문에서 말씀하셨듯 유저 fcmToken의 null 체크를 해주어야 하지 않을까요..?
null일 경우 클라이언트 측에서 fcmToken을 재발급을 하는 식으로요!
rinarina0429
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정말 새롭네요,,, 공부하고 적용까지 고생 많으셨습니다!! 레퍼런스 잘 받아가 공부할게요오
요고 일단 클라랑 지금까지 된 기능 확인해보고 다음 PR에서 추가할게요! |
Related Issue
Key Changes
/users/fcm-token에서 저장합니다ref2를 확인해보면 redis를 통해 TTL을 적용하는게 좋아 보입니다! 일단은 RDB에 저장하도록 했습니다. (null check도 추가해야 할 듯 합니다..ㅜ)FirebaseMessaging을 bean으로 주입시켜서서버 <-> FCM간에 통신합니다.sendPushMessage로, multiple device에 대한 push는sendMulticastMessage로 처리합니다.(specific과 multiple에 device에 대한 설명은 공식문서인ref1에서 확인할 수 있습니다.)ref1에서 확인할 수 있습니다.)To Reviewers
ref1랑ref2는 지금이 아니더라고 꼭 읽어보시길 추천하며, 플로우와 정해져있는 포맷을 이해하신다면 PR도 무리없이 파악될 것이라 생각합니다!References
ref1: https://firebase.google.com/docs/cloud-messaging/send-messageref2: https://firebase.google.com/docs/cloud-messaging/manage-tokensref3: https://swatiomar09.medium.com/behind-the-scenes-how-fcm-push-notifications-working-internally-56820cc70652ref4: https://firebase.google.com/docs/cloud-messaging/android/receiveref5: https://firebase.google.com/docs/cloud-messaging/ios/receive