簡體   English   中英

如何通過Web使用Firebase雲消息傳遞

[英]How to use firebase cloud messaging over web

我是Firebase的新手,想通過Firebase雲消息傳遞通過瀏覽器顯示通知,但問題是我混淆了在哪里編寫此代碼::

POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Content-Type: application/json
Authorization: key=YOUR_SERVER_KEY

{
  "notification": {
    "title": "New chat message!",
    "body": "There is a new message in FriendlyChat",
    "icon": "/images/profile_placeholder.png",
    "click_action": "http://localhost:5000"
  },
  "to":"YOUR_DEVICE_TOKEN"
}

請告訴我我必須在哪個文件中編寫此代碼。

任何幫助將不勝感激。

這是一個示例有效負載(請參閱此處的參數)。 您可以從自己的App Server生成請求,也可以在開發過程中使用PostmancURL簡單地發送下游消息。

還有使用Firebase Notifications Console的選項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM