question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firebase RealTime Database Socket connection error

See original GitHub issue

I am using fireabse real time database for my application. At times it it unable to form socket connection. But requests made to API hosted on firebase cloud-fucntion works properly. I have used following dependencies :-

    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-database:16.0.3'
    implementation 'com.google.firebase:firebase-storage:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.4'

When I turned on the debug level it gives following :-

2018-11-11 14:13:17.932 14446-14513/com.example.com D/ConnectionRetryHelper: Scheduling retry in 933ms
2018-11-11 14:13:18.867 14446-14513/com.example.com D/PersistentConnection: pc_0 - Trying to fetch auth token
2018-11-11 14:13:18.873 14446-14513/com.example.com D/PersistentConnection: pc_0 - Successfully fetched token, opening connection
2018-11-11 14:13:18.878 14446-14513/com.example.com D/Connection: conn_1 - Opening a connection
2018-11-11 14:13:48.881 14446-14513/com.example.com D/WebSocket: ws_1 - timed out on connect
2018-11-11 14:13:48.882 14446-14513/com.example.com D/WebSocket: ws_1 - closed
2018-11-11 14:13:48.882 14446-14513/com.example.com D/WebSocket: ws_1 - closing itself
2018-11-11 14:13:48.882 14446-14513/com.example.com D/Connection: conn_1 - Realtime connection failed
2018-11-11 14:13:48.882 14446-14513/com.example.com D/Connection: conn_1 - closing realtime connection

This keeps happening on certain device like Mi5 note pro, lenov

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
shahsurajkcommented, Mar 18, 2019

Getting the same error on Firebase Realtime database 16.1.0, it doesn’t work on mobile network, but works perfectly fine on WiFi networks, also is much likely to happen on a device running Android 9.

Logs:

2019-03-18 16:21:12.138 D/WebSocket: ws_1 - timed out on connect 2019-03-18 16:21:12.139 D/WebSocket: ws_1 - closed 2019-03-18 16:21:12.139 D/WebSocket: ws_1 - closing itself 2019-03-18 16:21:12.139 D/Connection: conn_1 - Realtime connection failed 2019-03-18 16:21:12.139 D/Connection: conn_1 - closing realtime connection 2019-03-18 16:21:12.139 D/PersistentConnection: pc_0 - Got on disconnect due to OTHER 2019-03-18 16:21:12.139 D/PersistentConnection: pc_0 - Scheduling connection attempt 2019-03-18 16:21:12.140 D/ConnectionRetryHelper: Scheduling retry in 539ms 2019-03-18 16:21:12.682 D/PersistentConnection: pc_0 - Trying to fetch auth token 2019-03-18 16:21:12.689 D/PersistentConnection: pc_0 - Successfully fetched token, opening connection 2019-03-18 16:21:12.692 D/Connection: conn_2 - Opening a connection 2019-03-18 16:21:42.697 D/WebSocket: ws_2 - timed out on connect 2019-03-18 16:21:42.699 D/WebSocket: ws_2 - closed 2019-03-18 16:21:42.699 D/WebSocket: ws_2 - closing itself 2019-03-18 16:21:42.699 D/Connection: conn_2 - Realtime connection failed 2019-03-18 16:21:42.699 D/Connection: conn_2 - closing realtime connection 2019-03-18 16:21:42.700 D/PersistentConnection: pc_0 - Got on disconnect due to OTHER 2019-03-18 16:21:42.700 D/PersistentConnection: pc_0 - Scheduling connection attempt 2019-03-18 16:21:42.702 D/ConnectionRetryHelper: Scheduling retry in 580ms 2019-03-18 16:21:43.284 D/PersistentConnection: pc_0 - Trying to fetch auth token 2019-03-18 16:21:43.287 D/PersistentConnection: pc_0 - Successfully fetched token, opening connection

The same snippet of message occurs in a loop.

0reactions
SuhasTScommented, May 15, 2019

I am facing the exact same issue. I am using Firebase Real-time database 16.1.0. As far as I have observed this occurs on some devices when they are on mobile data. This issue is creating a lot of issues in the app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unity+Firebase-Database[Error] WebSocket: ws_0 - could not ...
The message "No route to host" seems to indicate that the client can't reach the Firebase servers. This may indicate a problem in...
Read more >
Google Groups
You refresh the page before Firebase's WebSocket connection has been established. The error will show up as the first message in the log,...
Read more >
Firebase Realtime Database
The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client.
Read more >
Troubleshooting Teams: CyberEscape Online Database ...
If you are on a virtual machine or desktop and are receiving a Google Firestore: Default websockets failure, that might be the cause....
Read more >
Firebase vs Socket.IO - Ably Realtime
This Firebase vs Socket.IO comparison was created ... Build a realtime database with Socket. ... Which popular programming languages do Firebase and Socket....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found