본문 바로가기
개발/Firebase

Firebase 번역 -Firebase Cloud Messaging(1-3)

by dev_caleb 2022. 12. 3.
728x90

https://firebase.google.com/docs/cloud-messaging/concept-options?hl=en 

 

FCM 메시지 정보  |  Firebase 클라우드 메시징

Firebase Summit에서 발표된 모든 내용을 살펴보고 Firebase로 앱을 빠르게 개발하고 안심하고 앱을 실행하는 방법을 알아보세요. 자세히 알아보기 이 페이지는 Cloud Translation API를 통해 번역되었습니

firebase.google.com

 

About FCM messages

FCM 메시지에 대하여

 

 

Firebase Cloud Messaging (FCM) offers a broad range of messaging options and capabilities. The information in this page is intended to help you understand the different types of FCM messages and what you can do with them.

FCM은 넓은 범위의 메시지 옵션과 capabilities를 제공한다. 이페이지의 정보는 니가 다른 타입의 FCM메시지를 이해하고 그들로서 어떤걸 할 수 있는 지 이해하도록 돕기 위함이다.

Message types 메시지 타입

With FCM, you can send two types of messages to clients:

FCM을 가지고 두 가지 타입의 메시지를 client들에게 보낼 수 있다. 

  • Notification messages, sometimes thought of as "display messages." These are handled by the FCM SDK automatically.

 - notification message, 때로는 display message로 생각되는, 이것들은 FCM SDK에 의해 자동적으로 handled 된다.

  • Data messages, which are handled by the client app.

- 데이터 메시지, 클라이언트 앱에 의해서 handle 됨.

 

Notification messages contain a predefined set of user-visible keys. Data messages, by contrast, contain only your user-defined custom key-value pairs. Notification messages can contain an optional data payload. Maximum payload for both message types is 4000 bytes, except when sending messages from the Firebase console, which enforces a 1024 character limit.

 

notification messages는 미리 정의 된 유저-visible key들의 세트를 포함한다. 대조적으로 데이터메시지는 당신의  user defined 된 커스텀 key -value  pairs를 포함한다. Notification messages는 optiona data payload를 가진다. 두타입 모두 maximum playload는 4000 byte이다. firebase console로부터 메시지를 보낼 때를 제외하고(1024 character 제한)

 

notification message - FCM은 클라이언트 앱을 대신하여 최종 사용자 장치에 메시지를 자동으로 표시합니다. Notification messages에는 미리 정의된 사용자가 볼 수 있는 키의 집합과 optional custom key-value 쌍의 데이터 페이로드가 있습니다

how to send

  1. In a trusted environment such as Cloud Functions or your app server, use the Admin SDK or the FCM Server Protocols: Set the notification key. May have optional data payload. Always collapsible.
  2. See some examples of display notifications and send request payloads.
  3. Use the Notifications composer: Enter the Message Text, Title, etc., and send. Add optional data payload by providing Custom data.

1. Admin SDK나 FCM 프로토콜(notification key를 )을 사용하는 cloud functions나 당신의 앱서버,믿을 수 있는 환경  

2. display notification 과  payloads 요청 전송하는  예제를 참조하십시오.

3. Notification composer 사용하기 : - > 메시지 텍스트, 제목 등을 입력하고 발송합니다. Custom data를 제공하여 optional data payload를 추가합니다.

 

 

Data message

Client app is responsible for processing data messages. Data messages have only custom key-value pairs with no reserved key names (see below).

클라이언트 앱은 데이터 메시지 처리를 담당합니다. 데이터 메시지에는 예약된 키 이름이 없는 사용자 지정 키-값 쌍만 있습니다(아래 참조).

클라이언트 앱은 데이터 메시지 proccessing을 담당한다. 데이터 메시지에는 예약된 키 이름이 없는 custom key-value 쌍만 있습니다(아래 참조).

 

 

Use notification messages when you want FCM to handle displaying a notification on your client app's behalf. Use data messages when you want to process the messages on your client app.

 

당신이 client app에서 notification display를 FCM이 처리하도록 하려면 Notification Message를 사용합니다. 클라이언트 앱에서 메시지를 처리하려는 경우 데이터 메시지를 사용합니다.

 

FCM can send a notification message including an optional data payload. In such cases, FCM handles displaying the notification payload, and the client app handles the data payload.

 

FCM은 선택적 data payload를 포함하는 notification message를 전송할 수 있다. 이러한 경우 FCM은 notification payload display를 처리하고 클라이언트 앱은 data payload를 처리합니다.

 

 

Notification messages

 

For testing or for marketing and user re-engagement, you can send notification messages using the Firebase console. The Firebase console provides analytics-based A/B testing to help you refine and improve marketing messages.

To programmatically send notification messages using the Admin SDK or the FCM protocols, set the notification key with the necessary predefined set of key-value options for the user-visible part of the notification message. For example, here is a JSON-formatted notification message in an IM app. The user can expect to see a message with the title "Portugal vs. Denmark" and the text "great match!" on the device:

 

테스트 또는 마케팅, 사용자 재참여를 위해서, 당신은 Firebase console을 사용하여 notification message를 보낼 수 있다. 파이어베이스 콘솔은 analytics 기반 A/B test를 제공한다 - 니가 마케팅 메시지를 정제하고 향상시키는 것을 도와주기 위해.

프로그램적으로 adminSDK 또는 FCM 프로토콜을 사용해서 notification message를 보내기 위해, notification key를 필수 predifined set of key-value option과 함께 notificiation mesage의 user-visible part에 설정해야한다. 예를 들어  이것은 IMapp에 Json 포멧 notification message이다. 유저는  title "Portugal vs. Denmark"과 text  "great match!"를 device에서 message를 볼 것으로 예상할 수 있다.

 

{
  "message":{
    "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "notification":{
      "title":"Portugal vs. Denmark",
      "body":"great match!"
    }
  }
}

 

Notification messages are delivered to the notification tray when the app is in the background. For apps in the foreground, messages are handled by a callback function.

 

Notification messages들은 notification tray로 전송된다. 앱이 background에 있을 때. 앱이 foreground에 있으면, message는 callback function에 의해서 handle 되어진다.

(아.. 그러면 foreground에 있을 때는 callback으로 핸들링할 수 있다는 뜻이 되는구나. foreground가 아니면 handle 하기 어렵겠네? notification tray에서 어떻게 할 수 있으려나?)

 

See the reference documentation for the full list of predefined keys available for building notification messages:

notification message를 building 하는데 사용가능한 predefiend keys 리스트의 전체가 리스트 된 reference documentation를 보라.

 

Data messages

Set the appropriate key with your custom key-value pairs to send a data payload to the client app.

client app에 data payload를 보내기 위해 너의 custom key-value pairs 적합한 키를 세팅하라 .

 

For example, here is a JSON-formatted message in the same IM app as above, where the information is encapsulated in the common data key and the client app is expected to interpret the content:

예를 들어. 여기 JSON-formatted message는 위의 same IM app과 같다. 여기서 정보는 공통 데이터 키에 캡슐화되며 client app은 내용을 해석해야 합니다.

 

{
  "message":{
    "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "data":{
      "Nick" : "Mario",
      "body" : "great match!",
      "Room" : "PortugalVSDenmark"
    }
  }
}

 

The above example shows usage of the top-level, or common data field, which is interpreted by clients on all platforms that receive the message. On each platform, the client app receives the data payload in a callback function.

위의 예는 메시지를 수신하는 모든 플랫폼의 client가 해석하는 최상위 또는 공통 data field의 사용을 보여줍니다. 각 platform에서 client app은 callback 기능으로 데이터 페이로드를 수신한다.

 

 

 

Encryption for data messages(데이터 메시지 암호화)

 

The Android Transport Layer (see FCM architecture) uses point-to-point encryption. Depending on your needs, you may decide to add end-to-end encryption to data messages. FCM does not provide an end-to-end solution. However, there are external solutions available such as Capillary or DTLS.

 

Android 전송 layer(FCM 아키텍처 참조)은 point-to-point(p2p는 peer to peer)  암호화를 사용합니다. 필요에 따라 데이터 메시지에 엔드 투 엔드  암호화를 추가할 수 있습니다. FCM은 엔드 투 엔드 솔루션을 제공하지 않습니다. 그러나 Capillary 또는 DTLS와 같은 외부 솔루션을 사용할 수 있습니다.

 

 

Notification messages with optional data payload(Optional data payload를 추가한 Notificiation message )

 

Both programmatically or via the Firebase console, you can send notification messages that contain an optional payload of custom key-value pairs. In the Notifications composer, use the Custom data fields in Advanced options.

App behavior when receiving messages that include both notification and data payloads depends on whether the app is in the background or the foreground—essentially, whether or not it is active at the time of receipt.

 

프로그래밍적으로 또는 firebase console을 통해서, 당신은 notification message들(custom key-value pairs의 optional payload를 포함하는)을 보낼 수 있다. Notifications composer에서, advanced options에 custom date field를 사용해라. 알림 및 데이터 페이로드를 모두 포함하는 메시지를 수신할 때의 앱 동작은 앱이 background 에 있는지 또는 foreground에 있는지에 따라 달라집니다. 기본적으로, 수신 시점에 활성화되어 있는지 여부에 따라 다릅니다.

  • When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification. background에 있을 때, 앱은 알림 트레이에서 알림 페이로드를 수신하고 사용자가 알림을 누를 때만 데이터 페이로드를 처리합니다.
  • When in the foreground, your app receives a message object with both payloads available. foreground에 있을 때 너의 app은 메시지와 payload를 둘다 받는다.

Here is a JSON-formatted message containing both the notification key and the data key:

여기 notificiation key와 data key를 모두 포함하는 json 형태 message가 있다.

{
  "message":{
    "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "notification":{
      "title":"Portugal vs. Denmark",
      "body":"great match!"
    },
    "data" : {
      "Nick" : "Mario",
      "Room" : "PortugalVSDenmark"
    }
  }
}

 

 

 

 

728x90