1

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

David East
  • 31,526
  • 6
  • 67
  • 82
George Huang
  • 2,504
  • 5
  • 25
  • 47
  • 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 Nov 27 '15 at 17:07
  • 1
    You can write security rules to secure your data. https://www.firebase.com/docs/security/quickstart.html – David East Nov 28 '15 at 15:24

1 Answers1

1

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.

Community
  • 1
  • 1
David East
  • 31,526
  • 6
  • 67
  • 82
  • Thank you very much David. I will give it a try. For the SSL error: I am using AngularFire/ionic and angular. – George Huang Nov 28 '15 at 16:51
  • Which platform are you seeing the error on? iOS, Android, or Web? – David East Nov 28 '15 at 16:56
  • Then the AST configuration should help solve that issue. That would be setup in XCode. – David East Nov 28 '15 at 17:49
  • Thank you Dave. I added it into my plist. I am testing it. Will let you know. NSAppTransportSecurity NSExceptionDomains firebaseio.com NSIncludesSubdomains NSThirdPartyExceptionRequiresForwardSecrecy – George Huang Nov 28 '15 at 18:14
  • Did any of that help? – David East Nov 29 '15 at 18:13
  • I implemented the AST configuration, but it doesn't seems working... maybe I did something wrong there. I open config.xml file and found the section. I added the recommended configurations from AST configuration, but my app still cannot connect to the https resources, and this time only left for a couple of minutes, then lost the connection... – George Huang Nov 29 '15 at 21:13
  • After two weeks of testing and observing. Yes, this solution works! Thank you David :-) – George Huang Dec 08 '15 at 19:58
  • Hi David, could you please take a look at my question here? http://stackoverflow.com/questions/43286204/an-ssl-error-has-occurred-and-a-secure-connection-to-the-server-cannot-be-made – JIANG Apr 10 '17 at 18:33