If I start reading documents from a Firestore collection using a query.onSnapshot()
call, under what circumstances does Firestore automatically unsubscribe and stop reading docs?
Specifically, if the user closes the browser, or his computer crashes, what happens then? I presume that at some point Firestore will understand that the user is no longer there to receive the data, but how does that work?
I'm creating a PWA, so aside from the browser closing, my user might navigate 'within' the app. Do I have to make sure I meticulously unsubscribe from all open listeners or risk reading unused docs? Or is there some clever mechanism at work to 'garbage collect' abandoned onSnapshot listeners?
Since there is money involved, I'd like to know the specifics of all this. I'd rather avoid paying for document reads that I didn't need anymore.
Thanks!