简体   繁体   English

我可以使用 WebSocket 协议使用 ESP32S3 使用 ESP-IDF C 从 Cloud Firestore 发送和接收数据吗

[英]Can I use a WebSocket protocol to send and receive data from Cloud Firestore using an ESP32S3 Using ESP-IDF C

Google is deprecating Cloud Iot, so not an option.谷歌正在弃用 Cloud Iot,所以不是一个选择。 https://cloud.google.com/iot/docs/release-notes https://cloud.google.com/iot/docs/release-notes

Cloud IoT Core will be retired on August 16, 2023. After August 15, 2023, the >documentation for IoT Core will no longer be available. Cloud IoT Core 将于 2023 年 8 月 16 日停用。2023 年 8 月 15 日之后,>IoT Core 的文档将不再可用。

I would like to use Firebase - Firestore for my backend.我想使用 Firebase - Firestore 作为我的后端。 It takes all the hassles out of keeping a server up and running, scalability etc.它消除了保持服务器正常运行、可扩展性等方面的所有麻烦。

I managed to send data after login and authentication from an ESP32S3 using ESP-IDF in C, (note not Arduino, and not C++), and would like to know if I can rather use a websocket for the communication, once the Authentication done, and if so, can you give me a code example or pointers.我在 C 中使用 ESP-IDF 从 ESP32S3 登录和验证后成功发送数据(注意不是 Arduino,也不是 C++),并且想知道我是否可以使用 websocket 进行通信,一旦验证完成,如果是这样,你能给我一个代码示例或指示吗?

With a websocket, I can send data to my own server hosted in Europe, in less than 400ms.使用 websocket,我可以在不到 400 毫秒的时间内将数据发送到我自己在欧洲托管的服务器。 With Firestore, there is a large HTTP header, that includes the API key, and also the Auth Token, a large amount of data, quite a lot of handshaking going on over HTTPS, and eventually the data is sent.使用 Firestore,有一个很大的 HTTP header,其中包括 API 密钥,还有 Auth Token,大量数据,在 HTTPS 上进行了大量的握手,最终发送了数据。 This takes more than 1400ms.这需要超过 1400 毫秒。

We are weighing items in a farming scenario, and need to weigh very frequently, and the 1400ms with fast inte.net is not acceptable.我们在农耕场景中称重物品,需要非常频繁地称重,1400ms 的网速快是不行的。 So if I could still go with Firebase Authentication, and Firestore for data, I probably would be able to speed it up to even faster than 400ms if I could use a WebSocket client connection with the Firestore document store.因此,如果我仍然可以使用 go 和 Firebase 身份验证,以及用于数据的 Firestore,如果我可以使用 WebSocket 客户端连接与 Firestore 文档存储,我可能可以将它的速度提高到甚至超过 400 毫秒。 I can use the Refresh Token if needed to refresh the Auth Token, and thus keep the socket connection up, every 3600s as required by Firebase, (that also takes quite long) but less of a hassle, as only once every say 55 minutes.如果需要刷新 Auth Token,我可以使用 Refresh Token,从而保持套接字连接,按照 Firebase 的要求每 3600 秒(这也需要相当长的时间)但麻烦更少,因为每 55 分钟一次。 Any pointers, advice will be appreciated.任何指针,建议将不胜感激。

Firestore supports multiple SDKs and wire protocols, but none of them work over web sockets. The closest you can get with Firestore would be its REST API, which is documented here . Firestore 支持多种 SDK 和有线协议,但它们都不支持 web sockets。Firestore 最接近的是它的 REST API,记录在此处 It's not the easiest protocol to work with though, so I recommend using the API explorer that is built into the documentation to create examples for yourself.虽然它不是最容易使用的协议,因此我建议使用文档中内置的 API 资源管理器来为自己创建示例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 ESP32 在 AWS S3 上上传 txt 文件 - Upload txt file on AWS S3 using ESP32 Azure IoT 在尝试从 C/C++ 中的 ESP32 发送消息时超时 - Azure IoT times out while trying to send a message from an ESP32 in C/C++ 如何从 flutter 的 firestore 中的一个字段发送和接收两种类型的数据? - How can I send and receive two types of data from one single field in firestore for flutter? 如何从 cloud-firestore 中的集合接收所有文档对象? - How can I receive all document objects from a collection in cloud-firestore? 使用 Cloud Functions 访问 firestore 中的用户数据,但如何安全地发送 UID/IDToken? - Accessing user data in firestore using Cloud Functions, but how do I securely send the UID/IDToken? 来自 ESP8266 的 Firebase 云功能 POST HTTPS 请求 - Firebase cloud function POST HTTPS Request from ESP8266 从 Esp32(Micropython) 向 firebase 发布内容时出错 - Error while posting something from Esp32(Micropython) to firebase 如何在 cloud firestore 的 CollectionReference 中添加 DocumentID? 使用 flutter - How can i add DocumentID in CollectionReference of cloud firestore? Using flutter 如何使用 flutter 和 dart 从 Cloud Firestore 检索特定数据? - how to retrieve specific data from Cloud Firestore using flutter and dart? 使用 Cloud Firestore REST API 如何使用 http package 和 http.post() 方法发送数据 - Using Cloud Firestore REST API how to send data using http package with http.post() method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM