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

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

하기 링크들의 문서에서는 진행상의 해당 파트에(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

 

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
29 [mdn web docs] Service worker를 사용해 PWA를 오프라인에서 동작하게 만들기 황제낙엽 2024.07.20 121
28 [ChatGPT] 모바일 환경에서 웹앱의 캐시(cache) 데이터를 서비스에서 업데이트로 갱신하는 방법 황제낙엽 2024.07.17 127
27 [ChatGPT] service-worker.js 에서 cache file list 를 동적으로 생성하여 적용하기 황제낙엽 2024.07.17 105
26 (Copilot) PWA Builder 에 대하여 황제낙엽 2024.07.05 171
25 PWA 데모 샘플들 file 황제낙엽 2024.07.04 152
24 FirebaseMessagingException: Requested entity was not found. 황제낙엽 2024.01.12 1511
23 PWA 관련 서적 두권에 대한 목차와 후기 황제낙엽 2023.11.29 119
22 (Copilot) Admin SDK Reference의 java 라이브러리를 이용하여 notification을 fcm에 전송하는 java 예제 황제낙엽 2023.11.28 205
21 firebase.messaging().getToken() 함수와 pushManager.subscribe() 함수의 관계 황제낙엽 2023.11.26 275
20 service worker 재작성시 수동 업데이트 file 황제낙엽 2023.11.25 115
19 [POST/2023.09.13] PWA (Progressive Web Apps) 관련 황제낙엽 2023.11.24 98
18 [POST/2019.11.25] 브라우저 알림(Notification) 팝업에 버튼 추가 with ServiceWorker file 황제낙엽 2023.11.24 99
17 [FCM] FCM 으로 알림 전송 테스트 (spring boot + android + fcm rest) 황제낙엽 2023.11.24 178
16 [FCM] Firebase Console 에서 메세지 보내기 file 황제낙엽 2023.11.24 156
15 (OMNIBUSCODE/FCM/WEB/JAVA) web push notification (web browser) 샘플 file 황제낙엽 2023.11.23 146
14 (Copilot) Notification Server 의 종류 황제낙엽 2023.11.23 141
» (OMNIBUSCODE/FCM/WEB/JAVA) web push notification (web browser) 구현 절차 [1] 황제낙엽 2023.11.20 190
12 서비스 워커(service worker) 등록에 대한 LLM 챗봇의 답변 황제낙엽 2023.11.20 113
11 service worker 개발 참고용 링크 모음 황제낙엽 2023.11.10 124
10 service worker 개발을 위한 mozilla 공식 문서 file 황제낙엽 2023.11.10 103