Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max. number of document realtime listeners

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).

like image 504
M.Lewis Avatar asked Dec 23 '22 23:12

M.Lewis


1 Answers

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.

like image 196
Doug Stevenson Avatar answered Mar 29 '23 23:03

Doug Stevenson