그동안 관련 기술과 레퍼런스 문서들을 찾아 실습을 진행하는데

완료 시일이 자꾸만 늘어져서 진행했던 학습을 일부 반복하는 시행착오가 있어 이를 막기 위해 기록을 해둔다.

하기 링크들의 문서에서는 진행상의 해당 파트에(client 와 server 의 매커니즘) 대해서만 참고해야 한다.

FCM 의 API 들이 버전업을 하면서 개인 블로그의 포스팅에서 작성된 코드들이 deprecated 되거나 changed 된 것들이 많다.

  ex> Deprecated useVapidKey and useServiceWorker. Use getToken to set these values instead.

 

0. prologue

    0.0. https://galid1.tistory.com/740#:~:text=Push%20Notification%20%EB%8F%99%EC%9E%91

    0.1. 용어 정의

        - Notification Server

            FCM, GCM, APNs 와 같이, mobile 기기의 client app에 push notification 을 전송하는 서버

        - Client App

            사용자의 mobile기기에 설치된 app (service worker)

        - Provider

            push notification 을 생성하여 notification server 로 발송하는 서버

    0.2. notification 전송 과정

        - Client App을 Notification Server에 등록

        - Client App을 켜면 각각의 Client App을 구분하는 Token 을 Notification Server에서 발급

        - Client App에서 이 Token 을 Provider로 전송

        - Provider는 Token 을 저장

        - Client App에 알림을 전송할 필요가 있을때, Token 값과 함께 Notification Server에 요청

        - Client App에서 Push 알림을 수신

 

1. service worker 구현 및 등록 (client - web javascript)

    1.1. service worker 의 event 구현

        - service-worker.js 에 oninstall, onactivate, onfetch, onpush, onotificationclick 등의 이벤트 함수를 정의

    1.2. service worker 의 register(등록)

        1) jiniebox.js 에서 playServiceWorker() 함수 참고

        2) 레퍼런스

            - https://firebase.google.com/docs/web/alt-setup?hl=ko

            - https://firebase.google.com/docs/cloud-messaging/js/receive?hl=ko#setting_notification_options_in_the_service_worker

            - https://naitas.tistory.com/entry/%EC%9B%B9%ED%91%B8%EC%8B%9C-WEB-PUSH-FCM

 

2. fcm 설정 및 service 구현 (server - java)

    2.1. Google Firebase Messaging 프로젝트 생성

        - https://nsinc.tistory.com/218#:~:text=2%EB%8B%A8%EA%B3%84%3A-,Google%20Firebase%20Messaging,-Google%20Firebase%20Messaging

        - https://blog.naver.com/jinwoo6612/222479649921

    2.2. FCM 을 이용하여 메세지를 전송하는 방식 (선택하여 서버 서비스를 구현)

        2.2.1. FCM용 Firebase Admin SDK

            Admin SDK는 권한 있는 환경에서 Firebase와 상호작용 할 수 있게 해주는 서버 라이브러리 세트

            1) 적용 및 구현 절차

                - 서버에 Firebase Admin SDK 추가

                - SDK 초기화

                - Firebase 클라우드 메시징으로 메시지 보내기

            2) 레퍼런스

                - https://firebase.google.com/docs/reference/admin?authuser=0&hl=ko

                - https://firebase.google.com/docs/reference/admin/java/reference/com/google/firebase/messaging/package-summary?authuser=0

                - https://firebase.google.com/docs/admin/setup?hl=ko&authuser=0

                - https://blog.naver.com/saka/222626724097

                - https://blog.naver.com/steve6133/223155243517

                - https://herojoon-dev.tistory.com/23

        2.2.2. HTTP V1 API (REST)

            플랫폼간 메시징 솔루션을 제공하는 FCM 전송 REST API

            1) 레퍼런스

                - https://firebase.google.com/docs/reference/fcm/rest?hl=ko

                - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?authuser=0&hl=ko

                - https://galid1.tistory.com/740

                - https://blog.naver.com/aozp73/223061144172

 

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
23 FirebaseMessagingException: Requested entity was not found. 황제낙엽 2024.01.12 0
22 책 2권에 대한 목차와 후기 황제낙엽 2023.11.29 7
21 (Copilot) Admin SDK Reference의 java 라이브러리를 이용하여 notification을 fcm에 전송하는 java 예제 황제낙엽 2023.11.28 0
20 firebase.messaging().getToken() 함수와 pushManager.subscribe() 함수의 관계 황제낙엽 2023.11.26 1
19 service worker 재작성시 수동 업데이트 file 황제낙엽 2023.11.25 1
18 [POST/2023.09.13] PWA (Progressive Web Apps) 관련 황제낙엽 2023.11.24 1
17 [POST/2019.11.25] 브라우저 알림(Notification) 팝업에 버튼 추가 with ServiceWorker file 황제낙엽 2023.11.24 0
16 [FCM] FCM 으로 알림 전송 테스트 (spring boot + android + fcm rest) 황제낙엽 2023.11.24 0
15 [FCM] Firebase Console 에서 메세지 보내기 file 황제낙엽 2023.11.24 0
14 (OMNIBUSCODE/FCM/WEB/JAVA) web push notification (web browser) 샘플 file 황제낙엽 2023.11.23 3
13 (Copilot) Notification Server 의 종류 황제낙엽 2023.11.23 0
» (OMNIBUSCODE/FCM/WEB/JAVA) web push notification (web browser) 구현 절차 [1] 황제낙엽 2023.11.20 0
11 서비스 워커(service worker) 등록에 대한 LLM 챗봇의 답변 황제낙엽 2023.11.20 0
10 service worker 개발 참고용 링크 모음 황제낙엽 2023.11.10 0
9 service worker 개발을 위한 mozilla 공식 문서 file 황제낙엽 2023.11.10 0
8 service worker 개발을 위한 chrome 공식 문서 file 황제낙엽 2023.11.10 0
7 푸쉬 알림 개발 관련 레퍼런스 황제낙엽 2023.11.09 2
6 [bard] web-push와 fcm 의 차이 황제낙엽 2023.11.08 1
5 Web Push Notification 에 대한 web.dev(크롬) 의 문서 링크 황제낙엽 2023.11.07 0
4 PWA 관련 링크 모음 황제낙엽 2023.11.06 5