1
votes

I am new to Firebase. I believe it is a great tools for developing real-time applications.

I am wondering though, since objects/arrays in applications receiving updates(sync) from the firebase server, will those connections occupy and eat up a lot of bandwidth? Will firebase disconnect the clients that has no traffic after a certain time period? (like after one hour for example?)

How do I release the resources after my clients (mobile clients specially) "turn-off" the app? How do I re-connect to firebase resources when my clients "open" my app?

More specifically, I wrote a simple chat app without authentication, neither have any session logon/off. My app can work on browsers (via ionic serve) and it can also work on the real mobile devices. However, after a couple of hours, I got a SSL connection error as below:(on real-mobile devices)

Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.

Then my mobile app can no longer connect to firebase resources any more, unless I re-deploy the app, then it will live for a couple of hours then "die" again.

I am looking for the best practice to use firebase, or at least use it correctly. Any good example code out there? Thank you for your help :-)

1
Is there any way I can configure my firebase account to require authentication on the firebase server side? can anyone connect to my account as long as they know my https url? - George Huang
You can write security rules to secure your data. firebase.com/docs/security/quickstart.html - David East

1 Answers

1
votes

When an app is backgrounded, the connection will continue to live until the OS terminates the app from memory.

However, you can call Firebase.goOffline() when the user leaves the app and Firebase.goOnline() when the user enters the app. This will ensure that the connection only lives when the user is active in the app.

As for the SSL error, if this is on iOS you may want to check out ATS configuration with iOS9 and Firebase.