Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the firestore sdk use a connected socket to make its requests or individual http requests?

I'm using the react native firebase sdk and am wondering about how the underlying network calls are implemented. When making firestore get queries, is the sdk just keeping a socket open when it's initialized and make requests over the open socket, or does it make individual http requests to an endpoint?

Specifically I'm looking for an efficient way to get a batch of documents (profile thumbnail properties given a batch of profile ids), and I saw an answer that said that firebase calls are pipelined so calling the gets in parallel is efficient. However, I'm not sure if that applies to firestore as well.

like image 687
MonkeyBonkey Avatar asked May 29 '18 23:05

MonkeyBonkey


People also ask

How does Firebase SDK work?

The Firebase SDK collects basic app-usage data for you automatically, without the need to write any additional code. You can understand basic interactions such as: how many times your app was opened, how often in-app purchases were made, and how many users were active during a certain period of time.

Does Cloud Firestore use websockets?

Firestore is using websockets under the hood to react to changes, plus all the optimization based on lessons learned after the original firebase realtime db, it will scale! This is just a simple example and would require some restructuring and designing, but the ideas presented can and will scale.

How does onSnapshot work?

You can listen to a document with the onSnapshot() method. An initial call using the callback you provide creates a document snapshot immediately with the current contents of the single document. Then, each time the contents change, another call updates the document snapshot.

Is firestore an API?

Stay organized with collections Save and categorize content based on your preferences. Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.


1 Answers

The Firestore SDK uses gRPC to communicate with the server. This is the same layer that many of Google's other Cloud products use under the hood. It is quite different from the Web Sockets communication layer that the Firebase Realtime Database relied on.

like image 194
Frank van Puffelen Avatar answered Oct 15 '22 20:10

Frank van Puffelen