如何从 google 云 pubsub 中获取数据到 firebase 实时数据库

How can I take data from google cloud pubsub to firebase realtime data base

我需要从 google 云端获取数据 pubsub.The 数据由物联网生成 devices.Whenever 物联网设备将数据发送到云端 我需要将数据从 pubsub 传输到firebase 实时 database.I 只需要 database.How 中的最后更新值即可。

看看 Cloud Functions。他们将完全满足您的需求。

您需要设置和了解一些关于 firebase 的内容,因此首先查看基本教程也是一个不错的计划。

我最近做了一个session,我们在舞台上构建了一个应用程序,以及将我们的设备遥测带入 Firestore 的 Cloud Function(不是 Firebase RTD,但更新包中的相同概念):

https://github.com/GabeWeiss/GoogleIoTCoreApp/tree/master/gcf/telemetryToFirestore

那是云函数本身的代码。要了解您正在查看的作品的概念,请查看:

https://firebase.google.com/docs/ <-- Firebase 入门指南(尽管我再次建议直接使用 Firestore)

https://cloud.google.com/functions/docs/tutorials/pubsub <-- Pub/Sub 云函数教程的教程。