Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
145
rated 0 times [  149] [ 4]  / answers: 1 / hits: 26790  / 8 Years ago, mon, july 11, 2016, 12:00:00

I am using Firebase as real-time DB for mobile APP I'm developing (JS Web SDK), the structure is as below in the screenshot, the key = email, each key have the mobile user information, and GPS coordination of the mobile location inside node = path



How to listen on all the the path of all the emails (users)?



enter


More From » firebase

 Answers
139

Straight from the Firebase documents:




value: Read and listen for changes to the entire contents of a path.




var ref = firebase.database().ref(users);
firebase.database().ref().on('value', function(snapshot) {
// Do whatever
});


This function will run once when it is initiated and the once more for every change to the data under the path. snapshot will return all the contents of user/ which is a lot of data to be returned for every change. You can change the ref accordingly.


[#61427] Friday, July 8, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brooksb

Total Points: 480
Total Questions: 98
Total Answers: 106

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;