FIREBASE AND IONIC are great combination for mobile Apps, But there is an issue with both combination, i have created an App with both and noticed that at times the App just wont connect to Firebase to fetch data and some times is just so fast this loading and hanging factor is not good…
This hanging or loading forever problem is a big issue because it can cause a lot of App uninstall from users, i have read through similar topics e.g
BUT None Of these Solves my problem, i think this issue should be taking more seriously by ionic because Firebase and Ionic is a very Good combination.
THERE IS ALSO SOMETHING THAT I NOTICED IN ONE OF THE POST ABOUT “firebase:previous_websocket_failure” AND THAT WHEN THE VALUE IS SET TO TRUE THATS WHAT BRINGS ABOUT THE APP NOT BEEN ABLE TO CONNECT UNLESS YOU RESTART THE APP
SO DOES ANYBODY HAVE A SAMPLE CODE OF ALWAYS SETTING THIS VALUE TO FALSE WHEN ITS SET TO TRUE IN FIREBASE.
ANY HELP ON THIS FIREBASE LOADING AND HANGING ISSUE WILL BE APPRECIATED
Thanks Pierro for the suggestions i will give it a try, But i doubt if the issue is going online or about going offline, Since most times the Firebase request just get Stock forever,
One thing i want to ask you Pierro is that Does handling your connections on firebase prevents it from the Loading stall that sometime occurs when fetching data? Or calling the firebase Go online does it help to Clear the “firebase:previous_websocket_failure” i talked about?
can you please give me and insight on the kind of problem you had with firebase before you handled the connections your self.
And finally can you give me and Example code and where to initiate the goOnline and Offline ? is it on the controller or App.js
Pierro Thanks Once again, for the code snippet, But the Dead Socket does not just happen when the app is in Background. It happens When the App is open and you are trying to Pull a data from the the Firebase server it just keep loading forever or just give a blank page and just stay there until the app is relaunched,
What i am looking at is also how to also grammatically set the firebase:previous_websocket_failure
to false so it can re attempt to open a new connection.
I will also implement the goOnline() and goOffline() and see if it helps
All the same Thanks for your Input
I know what you mean, when you say the pulling data gets stuck forever.
However that socket died when you first put the app in background at least once for a time long enough to timeout. (that timeout is random though…)
What I’m trying to say is, for a socket to die, it had to be put in background at least once.
I have never encountered a problem where, I launch the app (a real launch, not from a pause state but also with the splashscreen etc), I stay on it without pausing, and suddenly my socket dies. There always had to be some background time for the socket to die…
I don’t know if it’s clear. But anyway, let me know how this snippet goes for you.
I’m using $cordovaNetwork plugin to take care of that.
It bothered me too long, now when I get shitty network or no network at all, I just launch a popup that won’t leave until the connection is back Better blocking the app than let the user believe it’s working when it’s not… (one of the cons of firebase in some cases, to update the view as if the database was updated, even when it’s not)
Hello Pierro i am still implementing your solutions you gave but please i need to ask you a question IS IT POSSIBLE TO WRITE FIREBASE RULES WITHOUT USING THEIR AUTH E.G USE IONIC AUTH THEN FIREBASE AS BACK END . HOW WOULD ONE SECURE FIREBASE?
I am no expert, but as far as i know YES, you cant really secure your firebase without firebase auth.
I released an app for couples on the Apple store, called “Bloom - game for couples”, i am using firebase login (+ Facebook ) and lots of firebase sécurity rules to make the whole thing private for couples.