Javascript 如何通过web使用firebase云消息传递

Javascript 如何通过web使用firebase云消息传递,javascript,firebase,firebase-cloud-messaging,Javascript,Firebase,Firebase Cloud Messaging,我是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

我是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"
}
请告诉我我必须在哪个文件中编写此代码

任何帮助都将不胜感激。

这是一个示例负载(请参阅参数)。您可以从自己的应用服务器生成请求,也可以在开发过程中发送下游消息或消息

还有使用的选项