-
Notifications
You must be signed in to change notification settings - Fork 928
.info/connected does not change to false when offline #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information. |
Hiranya, do you know if this a Node only issue? Our networking layer is different in Node and I wonder whether this is something we never supported (it also doesn't make as much sense in Node as it does on the mobile platforms). |
FWIW, I would expect it to work (the websocket connection should die and trigger .info/connected to change), but it may take a really long time (e.g. 15 minutes) depending on OS TCP timeout settings, etc. |
I have only tested this in Node (with the Admin SDK). I think @mikelehen may be right. I remember seeing this event fire long time (> 15 mins) after a disconnect. Since the delay was long, I brushed it off as a fluke. I also agree that it is not a very popular use case for server-side environments. So may be we can just ensure it works in the web SDK, and document the behavior for Node? |
It really depends on the underlying network stack. We have seen that this event doesn't fire for a full hour on some Android devices as the TCP retry window prevents the network stack from bubbling up these connection drops. |
+1 |
I have the same after upgrading to 4.1.5 (https://firebase.google.com/support/release-notes/js) - previous versions where OK.
|
As @AndryBray pointed out, I am having the same issue (event firing twice - offline followed by online). The example at: https://firebase.google.com/docs/database/web/offline-capabilities#section-presence works fine with 4.1.3 but doesn't work with 4.1.4 (and 5.0.4). |
For me it's never turning true... It's stuck at false.. |
I think this is a reasonable argument for using heartbeat keepalive |
Just for posterity, My issue was somewhere in the system it disconnected using |
I can confirm that it works with 4.1.3 but not with latest version (5.9.0) |
on chrome, using 6.0.0, problem persists. |
I have the same as @AndryBray : when simulating a disconnect in chrome by using devtools, I get an offline directly followed by online. If I run: async isConnected(): Promise { then it returns true, while I have in the network tab of chrome devtools that I'm offline. version: "firebase": "6.0.2", |
Having same issue as well Also occurs with firebase 6.1.1 |
+1 on firebase 6.2.0 |
Also seeing this with 6.2.3, what is the plan for this issue as its been open for nearly 2 years now? |
+1 on firebase 6.6.1 on node |
+1 more than 3 still not solved. |
Just encountered this again, with latest libraries. |
Does this work for anyone? This is what I see:
There's some interesting insight about |
This is also happening to me on Chrome. Setting "offline" in dev tools on chrome also caused a |
@johnnyoshika I have the same issue, where I get 2 |
@oveddan it's a very strange behaviour. I think it's a bug. |
@schmidt-sebastian |
I'm running into the same issues that toggling network status in the Chrome/Chromium DevTools (v 91.0.4472.77) fires twice and stays in the "online" state (despite network being toggled off). I'm on version It makes debugging online/offline behavior unnecessarily complicated. |
almost 4 years and still bug. |
I built a lot of my application based on this documented feature, and as a result of this bug it's lead to some pretty critical bugs happening in my application. If it's not working as documented and expected, and there doesn't seem to be a stated acknowledgement of the issue or plan to look at it, then why leave it in the documentation? |
If you are using React: it only works when inside a React.useEffect(() => {
database.ref('.info/connected').on('value', (snapshot) => {
const isOnline = snapshot.val();
});
}, []); I'd also advise to use a |
@Rubilmax, which part are you referring to when you say it works inside of |
I am referring to how
I did not test any feature related to I originally posted my comment because at first I was going to register the listener at the root of my app: I had not results and that's the reason I came upon this issue. However, after having moved the listener registering part inside a |
@Rubilmax Thanks. Use case 1 and 3 that you're seeing is the same behavior that I saw for I still believe there's a problem with Note:
|
I have the same situation here. info/connected events called with the first with value false the second with true, then I set my network offline through chrome dev tools .info/connected called twice with value false and the second with true. when I firebase version: 8.9.1 |
Any solution to this issue? The issue is getting connected=false, and connected=true right after. It also seems like none of the firebase calls (.set(), .update()) go through once I get this issue. |
@vasujogani are you still having issues on the latest version of the JS SDK? |
Hey @hiranya911. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Since there haven't been any recent updates here, I am going to close this issue. @hiranya911 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this. |
From firebase/firebase-admin-node#99
I've verified that this issue occurs with latest RTDB code as well (
@firebase/database 0.1.2
)Environment
Debian buster
Node.js v 8.5.0
firebase-admin v ^5.0.0
Steps to reproduce:
When internet connection is disabled, application should print "Firebase disconnected".
It seems, it never does!
Relevant Code:
The text was updated successfully, but these errors were encountered: