-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Server onDisconnect event #26
Comments
Thanks for reporting. Will be looked at this weekend. It's probably related to #25 where the events and listeners are all mangled up. |
It's working. |
@Ehesp by mangled do you mean the approach to using the listeners? My code in particular, or on Firebase's end? If there is an issue in the approach of my code sample in #25, please advise. I'm more than willing to change it. I was following the RNF examples approach @Salakar shared with me: https://github.com/invertase/react-native-firebase-examples/blob/1d3fd13d2f552560fa5630bc12ad04785e301edf/src/examples/chat/Chat.js |
@AndrewHenderson there's some logic in the RNFirebase db implementation that's causing the issue you're experiencing. RNFirebase's initial implementation of database refs has some logic in to de-duplicate refs and their listeners at the same path and query modifiers, obviously this is incorrect, two refs to the same path should both still get the initial event as well as the subsequent events, but the de-dupe logic breaks this, the first listener to a path with get both, the 2nd listener and onwards will only get new events that come through and no initial events. This is what needs fixing our end. Nothing to worry about your end 👍 |
I'm trying create a presence system using react-native-firebase but it seems the onDisconnect callback is never called.
var userid = 33;
var amOnline = firebase.database().ref('.info/connected');
var userRef = firebase.database().ref('presence/' + userid );
amOnline.on('value', function(snapshot) {
if (snapshot.val()) {
userRef.onDisconnect().remove();
userRef.set(true);
}
});
it's not this available to be used or am I making some confusing?
The text was updated successfully, but these errors were encountered: