I'm using Firebase on the web, with Javascript.
how can I close the connection to the realtime DB ?
var config = {....};
firebase.initializeApp(config);
// get the firebase DB reference
var db = firebase.database().ref();
//doing something
db.push(....);
// close the firebase connection ???
db.close() || firebase.disconnect() || or something like that...
Tried lots of functions - goOffline() , close() , ect.
But nothing does the trick.
Any help would be appreciated... tnx mates
Try this-
firebase.initializeApp(config);
// Kill this firebase app.
firebase.app().delete().then(function() {
firebase.initializeApp(newConfig);
});
goOffline() will close connection but Firebase will continue to work locally and the app will remain in memory.
Try using:
firebaseRef.off();
This will end your connection with firebase and stop communicating with the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With