Reputation: 64
I am writing a Flutter Android application that uses Cloud Firestore to conduct CRUD operation.
As part of the specification document I have to describe how the app reads and writes to the database. This includes what connection is opened (TCP ) what protocols are used (HTTP/2) does it send any requests, data transferred etc.
In the app I am writing and reading JSON like data It is my understanding the firestore uses the connection and protocol listed above. Could someone provide in detail how these operations work? More specifically could you explain how these operations are done? And also point me to relevant documentation/articles if any.
Write
Future addMember(Member mem) {
return FirebaseFirestore.instance
.collection(Collection.church)
.doc(Document.members)
.collection(Collection.churchmembers)
.doc(mem.uid)
.set(mem.toJson());
}
Read
Stream<QuerySnapshot> getServices() {
return FirebaseFirestore.instance
.collection(Collection.church)
.doc(Document.services)
.collection(Collection.churchservices)
.snapshots();
}
Upvotes: 1
Views: 482
Reputation: 1699
As stated in the first answer, the two APIs used by Firestore are RESTful and gRPC; you can find this information in the "How does it work?" section of the following document [1].
Now, answering your question about the protocol they use, the short answer is that both use HTTP, but you can find a better explanation in this document [2].
For the different methods the REST and gRPC APIs use, you can take a look at the following resources: [3], [4].
[1] https://firebase.google.com/docs/firestore
[3] https://firebase.google.com/docs/projects/api/reference/rest
[4] https://firebase.google.com/docs/firestore/reference/rpc
Upvotes: 1