I'm wondering whether there is a maximum number of Firestore realtime listeners I can use, and if there is an overhead per listener?
This is for a page in a React web app. I want to monitor changes in all documents within a collection, so I have the option of either using multiple document listeners, or a single collection query listener. The typical number of documents will be 20-30, but could grow to around 100 for edge cases (I won't be setting a limit, and wouldn't intend on using 'limit()'.
The Firestore architecture is along the lines of:
/projects/{project}/sections/{section}
Example: A user can edit sections within "project_abc".
I can either setup a single query listener on the 'sections' collection, and then will need to loop through the snapshot (ie multiple docs) on each change, or attach a new document listener to each section (ie. could end up with 30+ listeners).
All of the documented limits of Cloud Firestore are documented here. Most of the limits are placed on writing of data. The only limit that would affect your specific case is the number of (unique client socket) connections capped at 1 million. The listeners themselves are cheap, and you shouldn't be worried about lots of listeners attached to a document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With