I need a solution that calls the Firebase DB API for several key-based elements and returns the data (children) of these keys (in one answer).
Since I don't need data to come in real time, some standard REST call made once (and not a Firebase DB listener), I think that would be ideal.
There would be no other listener in the application, and the WebSocket connection is open. However, I looked through the Firebase API docs and it doesn't seem like there is a way to do this.
Most of the answers I've seen always suggest making a composite key / index of a certain type and filtering accordingly using a composite key, but this only works for searching by range. Or they suggest simply investing data and not worry about backups and disk space (and faster), instead of getting related data through foreign keys.
However, the problem is that I use Geofire, and its query method returns only the keys of the elements, not the data of the elements. All documents and previous answers involve receiving data either using the real-time SDK, which I tried to use using the once method or making a REST call for all elements and filtering with orderBy , startAt , endAt and locally filtering the keys I need.
This might work, but the potential overhead of extracting a lot of elements that I don't need only to filter them seems wasteful. The approach using the once listener seems wasteful because it represents a server route for each element. This approach is explained in this pretty good post , but according to this explanation, it still makes a circuit for each element (even if it is asynchronous and through the same connection).
This poor soul asked a similar question , but did not receive many useful answers (which really take into account the cost of creating n number of server requests).
Can someone explain the approaches to how this can be done, and the pros / cons once and for all? Thanks.
javascript rest firebase firebase-database geofire
caveman39
source share