In Firestore or Realtime Database, how many active users can listen for changes to the same document simultaneously? For instance, if 1000 users are subscribed to updates on one dokument will all users reliably receive notifications when that field is updated? Are there any limits to the number of listeners per document or per field, especially in terms of scalability?
const documentRef = doc(fireStore, 'app-version', 'GDqbs283dl4lwOncr6WT');
const unsubscribe = onSnapshot(
documentRef,
(docSnapshot) => {
const data = docSnapshot.data() as { appVersion: string } | undefined;
if (data?.appVersion) {
setLocalAppVersion(appVersion);
//...
// if the app's local ver is diffrent then we have a new update
}
},
(error) => {
errorHandling(error, 'useSessionHandler onSnapshot');
}
);
}, []);
// Rules
match /app-version/{documentId} {
allow read: if allowIfAuthPremium(request,userId) // only premium users are illigible.
allow write: if false; // Deny all write operations
}