将Firebase数据库与FCM集成 [英] Integrate Firebase Database with FCM

查看:148
本文介绍了将Firebase数据库与FCM集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将Firebase实时数据库与新推出的Firebase云消息传递服务集成?

我正在构建一个使用Firebase实时数据库存储数据的应用程序。我想通知我的用户使用数据库中每个新插入的推送通知。我遇到了教你如何使用FCM的教程,但是其中大多数需要你设置你自己的服务器来存储令牌。
是否有无服务器的方式来整合Firebase数据库与FCM?

解决方案

发送消息到设备基于插入到Firebase数据库将要求您运行受信任的进程,通常在您控制的应用程序服务器上运行。此受信任进程监听数据库更改,然后调用Firebase Cloud Messaging发送消息

有关如何从node.js脚本发送消息的示例,请参阅此处的答案:


Is there a way to integrate the Firebase real time database with the newly introduced Firebase Cloud Messaging services ?
I am building an app which uses the the Firebase realtime database for storing data. I want to notify my users using push notifications for every new insert in the database. I came across tutorials which teach you how to use FCM, but most of them require you to set up your own server for storing tokens. Is there a serverless way of integrating Firebase DB with FCM ?

解决方案

Sending messages to devices based on inserts into the Firebase Database will require you to run a trusted process, typically on an app server that you control. This trusted process listens to the database changes and then calls Firebase Cloud Messaging to send the messages.

For an example of how to send messaging from a node.js script, see my answer here: How to send Firebase Cloud Messaging from a node server?

这篇关于将Firebase数据库与FCM集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆