Skip to content

.info/connected does not change to false when offline #99

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

Closed
tonila opened this issue Oct 4, 2017 · 2 comments
Closed

.info/connected does not change to false when offline #99

tonila opened this issue Oct 4, 2017 · 2 comments

Comments

@tonila
Copy link

tonila commented Oct 4, 2017

Environment

Debian buster
Node.js v 8.5.0
firebase-admin v ^5.0.0

Steps to reproduce:

  1. Start application and wait for console log "Firebase connected!"
  2. Go offline (switch off wifi or remove lan cable etc.)

When internet connection is disabled, application should print "Firebase disconnected".
It seems, it never does!

Relevant Code:

"use strict";

var path = require('path');
var admin = require("firebase-admin");

var serviceAccount = require(path.join(__dirname, "some-firebase-adminsdk-lu0x5-82c66d50f5.json"));

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://some.firebaseio.com/"
});

const database = admin.database();

var connectedRef = database.ref(".info/connected");
connectedRef.on("value", function(snap) {
  if (snap.val() === true) {
    console.log("Firebase connected!");
  } else {
    console.log("Firebase disconnected!");
  }
});
@zyzski
Copy link

zyzski commented Oct 10, 2017

experiencing similar behavior. set to offline mode in network tab it goes disconnected -> connected immediately.

logging the status shows:

16:04:12.402 connected: false
16:04:12.530 connected: true

@hiranya911
Copy link
Contributor

I've verified that this issue occurs with latest RTDB code as well. Reported at firebase/firebase-js-sdk#249. Lets track the progress there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants