mobizt / Firebase-ESP-Client

[DEPRECATED]🔥Firebase Arduino Client Library for ESP8266, ESP32 and RP2040 Pico. The complete, fast, secured and reliable Firebase Arduino client library that supports RTDB, Cloud Firestore, Firebase and Google Cloud Storage, Cloud Messaging and Cloud Functions for Firebase.
MIT License
468 stars 99 forks source link

Firestore update #22

Closed giorgio80 closed 3 years ago

giorgio80 commented 3 years ago

hello,

first many compliments for the library.

As I'm using Firestore I would like to ask if stream , that in Firestore are realtime updates, are supported

thanks

mobizt commented 3 years ago

That feature is not available in the REST APIs this library used.

Only RPC protocol (gRPC) supports this feature and the RPC in the embedded device is not supported as it based on http2 or partly support in ESP32 from Esspressif (voice assistance sdk) but they don't provide the sources.

But you can use the Cloud Functions to do this on the backend e.g. the update event from document or collection changes can be used to set the RTDB data and you can stream that data in RTDB instead.

This approach is easy and suitable for small memory device which you can do many things in the Cloud Functions before giving the result.

The big update of this library which will available today provide the easy way to create and deploy the Cloud Functions and supports the Google Cloud Storage which allows the large file upload and many bugs fixed.

giorgio80 commented 3 years ago

hello @mobizt thanks for the suggestion. On other side , on classic real-time database, the stream object ( acting as realtime update) is basically polling continuously to the system ?

mobizt commented 3 years ago

No polling in stream connection.

The connection between client and server keeps open and server will push the data to client based on event without client request.

giorgio80 commented 3 years ago

Ou,

just from a technical point of view which is then difference with Firestore ? I mean there's no stream possibility with Firestore, am I wrong ?

mobizt commented 3 years ago

You should read in the Firebase Doc.

Firestore REST APIs used by the library is missing the realtime monitoring capabilities. This available on other clients that Firebase SDK was installed e.g. Web, iOS, Android, Java.

The embedded device can work with Firebase only via REST APIs. https://github.com/mobizt/Firebase-ESP8266/issues/126 https://github.com/mobizt/Firebase-ESP8266/issues/76 https://stackoverflow.com/questions/64832636/does-firebase-firestore-rest-api-support-streaming

mobizt commented 3 years ago

I don't know your experiences about Firestore and which client you ever used. I recommend you to read the Firebase's Firestore doc about the concept, abilities and limitations.