Firebase v3.8.0 and Ionic 3 Slow Connection on Initialization

1,133 views
Skip to first unread message

Jason Ho

unread,
Apr 21, 2017, 10:22:13 AM4/21/17
to Firebase Google Group
Hi, the issue was reported at here https://github.com/driftyco/ionic/issues/11290 and here https://forum.ionicframework.com/t/ionic-3-super-slow-with-firebase-on-device-emulator/87233/45

 I am facing the same issue. We are not sure if this is due to Ionic 3 or Firebase 3.8.0 which is causing the delay.

The first Firebase connection is slow but subsequent listeners are normal.

This is only happened to real devices but not browser. The same code is working normal with browser.

Here is the android (real device) console log from firebase.database.enableLogging(true);

2017-04-21 21:04:50.211 main.js:122484 Ionic Native: deviceready event fired after 3091 ms
2017-04-21 21:04:50.406 assets/icon/favicon.ico Failed to load resource: net::ERR_FILE_NOT_FOUND
2017-04-21 21:05:01.875 assets/icon/favicon.ico Failed to load resource: net::ERR_FILE_NOT_FOUND
2017-04-21 21:05:02.726 main.js:40326 p:0: Listen called for /firebaseURL-not-shown {"ep":"w238~","i":"g","sp":"w238s"}  
2017-04-21 21:05:02.730 main.js:40326 p:0: Listen called for /irebaseURL-not-shown {"ep":"w238s","i":"g","sp":"w238h"}  
2017-04-21 21:05:50.156 main.js:40326 p:0: Auth token refreshed  
2017-04-21 21:05:50.159 main.js:40326 getToken() completed. Creating connection.
2017-04-21 21:05:50.164 main.js:40326 c:0:0: Connection created  
2017-04-21 21:05:50.175 main.js:40326 c:0:0:0 Websocket connecting to wss://s-usc1c-nss-132.firebaseio.com/.ws?v=5&ns=firebaseURL-not-shown  
2017-04-21 21:05:52.693 main.js:40326 c:0:0:0 Websocket connected.  
2017-04-21 21:05:52.708 main.js:40326 c:0:0: Realtime connection established.  
2017-04-21 21:05:52.710 main.js:40326 p:0: connection ready  
2017-04-21 21:05:52.718 main.js:40326 p:0: reportStats {"c":{"sdk.js.3-8-0":1,"framework.cordova":1}}  
2017-04-21 21:05:52.720 main.js:40326 p:0: {"r":1,"a":"s","b":{"c":{"sdk.js.3-8-0":1,"framework.cordova":1}}}  
2017-04-21 21:05:52.728 main.js:40326 p:0: Listen on /firebaseURL-not-shown for default  

As you can see from the log, it took 48s for the "Auth token" to be fired.

If I downgraded the firebase version to 3.7.6, the delay was significantly reduced.

My dependencies are as below:

"dependencies": {
 
"@angular/animations": "4.0.0",
 
"@angular/common": "4.0.0",
 
"@angular/compiler": "4.0.0",
 
"@angular/compiler-cli": "4.0.0",
 
"@angular/core": "4.0.0",
 
"@angular/forms": "4.0.0",
 
"@angular/http": "4.0.0",
 
"@angular/platform-browser": "4.0.0",
 
"@angular/platform-browser-dynamic": "4.0.0",
 
"@angular/platform-server": "4.0.0",
 
"@ionic-native/core": "3.5.0",
 
"@ionic-native/geolocation": "3.5.0",
 
"@ionic-native/google-maps": "3.5.0",
 
"@ionic-native/splash-screen": "3.5.0",
 
"@ionic-native/status-bar": "3.5.0",
 
"@ionic/storage": "2.0.1",
 
"@ngx-translate/core": "6.0.1",
 
"@ngx-translate/http-loader": "0.0.3",
 
"angular2-qrcode": "2.0.1",
 
"angularfire2": "^4.0.0-rc0",
 
"firebase": "^3.7.6",
 
"geofire": "4.1.2",
 
"ionic-angular": "3.0.1",
 
"ionicons": "3.0.0",
 
"ngx-pipes": "1.5.9",
 
"rxjs": "5.1.1",
 
"sw-toolbox": "3.6.0",
 
"zone.js": "^0.8.5"
 
},
 
"devDependencies": {
 
"@ionic/app-scripts": "1.3.4",
 
"typescript": "2.2.2"
 
},

Bassam

unread,
Apr 21, 2017, 6:27:35 PM4/21/17
to Firebase Google Group
Thanks Jason for reporting this. We will look into it.

Bassam

Bassam

unread,
Apr 21, 2017, 9:06:32 PM4/21/17
to Firebase Google Group
Ok, so it seems the reason is we now support OAuth signInWithRedirect in Cordova:
In order to do so, we require some plugins to be installed.
If you install the plugins, you should be good. 
We are quickly working on a fix to not require the plugins if you do not plan on calling signInWithRedirect. Should be out in the next release.

Thanks for reporting this issue once again and we apologize for the inconvenience.

Bassam

Jason Ho

unread,
Apr 22, 2017, 1:20:19 AM4/22/17
to Firebase Google Group
Hi Bassam,

Thank you for clarification. 

I had installed all the plugin and the firebase connection is lighting fast.

Bassam Ojeil

unread,
Apr 25, 2017, 7:18:14 PM4/25/17
to fireba...@googlegroups.com
Hey Jason, this should be fixed in 3.9.0 release:
Let me know if you discover any issues.

Bassam

--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/svgk3GNcY0o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/ff4f96ff-d72e-4bc4-9607-e42a953fb67e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JasonHoch

unread,
Apr 27, 2017, 8:09:51 PM4/27/17
to Firebase Google Group
Hi Bassam,

Looking good so far.

Thank you.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.

Bassam

unread,
May 3, 2017, 1:35:10 AM5/3/17
to Firebase Google Group
Cool. Thanks for the follow up.
Reply all
Reply to author
Forward
0 new messages