dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
570 stars 460 forks source link

Firebase Realtime Database #502

Open cdgco opened 3 years ago

cdgco commented 3 years ago

Feature request

Would it be possible to add support for reading and writing to the Realtime Database?

I saw references to Realtime Database in the changelog but it seems those were referring to Firestore and there is currently no support for Realtime Database.

I found two other plugins that had support for realtime database:

However, neither are maintained, and do not compile, although they may serve as a good starting point for building support here; one of them is also based off of cordova-plugin-firebase.

Thanks!

dpa99c commented 3 years ago

Since Firestore is the successor to Realtime Database and is in many ways better (see here), adding support for Realtime Database is low on my priority list.

cdgco commented 3 years ago

That makes sense. I didn't realize that Firestore was newer, I'll look into converting my app to use Firestore in that case. Thanks.

cdgco commented 3 years ago

Just wanted to provide an update to this. While I was able to convert my app to use Firestore for the time being, it is a messaging app, and it seems that Realtime Database would be much better suited for this as Firestore has a limit on queries while Realtime Database does not.

Since each message is it's own document, retrieving message history for each user has already proven to push my app to the query limit for Firestore causing me to add very conservative limits on message history. Therefore, I still would look forward to seeing this feature added in the future.

ianitsky commented 3 years ago

Hello @cdgco @dpa99c

I added realtime database to my project. @dpa99c How you want my pull request? As part of this repository, or in a new repository (plugin) that extends firebasex?

For the second option, please, create this new repository.

Thanks.

dpa99c commented 3 years ago

@ianitsky if you want to add realtime database support it would be best to add it directly to this plugin repo: while I'd like to break down this plugin out of its inherited monolithic state into logical modules (#291), I realistically don't have the time at the moment to perform the necessary refactor for this.

You can use the Firestore functions as a template. If it looks like there is going to be a name clash with an existing method, then namespace the method names e.g. fetchXfromRealtimeDatabase(). The documentation and example project would also need updating to validate/demonstrate the new functionality.

ianitsky commented 3 years ago

My code (Not finished yet)

Realtime database have terminologies and works different from firestore.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mzaman07 commented 3 years ago

@ianitsky

I took some of your code and in my fork I have created a basic version of the realtime database APIs. Added iOS support.

@dpa99c

Are you Ok with a PR fixing this piece? I didn't really follow the whole using the example project. I created my own to ensure the code compiles. Looks like I'll have to copy stuff over.

mzaman07 commented 3 years ago

OK I updated the example project. Just need to test it on my MAC computer and then I should be able to make a PR for both repositories.

ianitsky commented 2 years ago

@mzaman07 Do you need any help to finalize your project and create the PR?