Is there a way of getting if the user is connected/disconnect while reading data from database? I know there's .onDisconnect
and database().ref('./info/connected')
but what i want to know is if there's something more like this:
firebase.database().ref('/someURL').once('value').then(snap => {
//READ DATA
}, err => {
//GET THE DISCONNECT HERE
}).catch(err => {
//OR GET HERE
});
Looking on the docs i wasn't able to find a error code for disconnection.
Thanks in advance.
Nope, that type of callback doesn't exist.
When you attach a listener to a location while the device is not connected to the back-end, one of two things can happen:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.