[英]How can I send a Notification via Firebase Cloud Messaging from a cloud function?
The documentation at https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.md#getmessaging does not explain where the "firebase-admin/messaging" module is. https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.md#getmessaging上的文档没有解释“firebase-admin/messaging”模块的位置。 What is the require path to get this module?获取此模块的 require 路径是什么?
for instance例如
const { getMessaging } = require("firebase-admin/messaging");
does not work.不起作用。
I also looked into the cloud functions sdk at https://firebase.google.com/docs/reference/functions#functions.pubsub where I see the Message class but no way to send a message.我还在https://firebase.google.com/docs/reference/functions#functions.pubsub上查看了云函数 sdk,在那里我看到了 Message 类,但无法发送消息。
Finally found it:终于找到了:
const messaging = admin.messaging();
which means that the documentation at https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0 is outdated.这意味着https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0上的文档已过时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.