I'm working on a feature on iOS for which we want to query a Firebase realtime database, which only updates about once a week. I saw there is a limit of 200k simultaneous connections (for the Blaze plan). My question is: what counts as an active connection?
For example, if we create an observation using the .observe()
method, does that mean 1 connection as long as we are observing?
And what about a 'one shot' fetch, using .getData()
. Does this close the connection after completion?
We're not actually interested in keeping an observation alive for a long time, as data only changes about once a week.
CodePudding user response:
From the frequently asked questions:
A simultaneous connection is equivalent to one mobile device, browser tab, or server app connected to the database. Firebase imposes hard limits on the number of simultaneous connections to your app's database. These limits are in place to protect both Firebase and our users from abuse.
The SDK connects to the server the first time that you try to access data from (or write data to) the database. The connection stays open for as long as the client has an active listener (so observe
in your case) or until about 5 minutes after the last read or write operation.
You can also explicitly control the connection by calling goOffline
and goOnline
in your code.