Skip to content
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

Indicate if subscribe/unsubscribe to topic failed #422

Closed
svenboogaarthotraco opened this issue Jun 8, 2020 · 3 comments
Closed

Indicate if subscribe/unsubscribe to topic failed #422

svenboogaarthotraco opened this issue Jun 8, 2020 · 3 comments
Labels
legacy Related to inherited code/functionality runtime issue An issue related to app runtime

Comments

@svenboogaarthotraco
Copy link

svenboogaarthotraco commented Jun 8, 2020

Documentation issue

What happens when the methods do not work.
E.g. if subscribe fails how can one detect it, as the return type is void according to https://github.com/dpa99c/cordova-plugin-firebasex/blob/master/types/index.d.ts#L55

@dpa99c
Copy link
Owner

dpa99c commented Jun 8, 2020

These functions are directly inherited from cordova-plugin-firebase.

Looking at the source code, neither Android or iOS returns a result for subscribe/unsubscribe actions.

However, looking at the Firebase documentation, it looks like subscribeToTopic on Android returns a Task object which should indicate a success/failed state, and on iOS it should be possible to change from using subscribeToTopic: to subscribeToTopic:completion: which also indicates if an error occurred.

The same should be possible for unsubscribe actions.

So rather than being a documentation issue, this is a legacy code issue in that it doesn't actually indicate whether there was an error in subscribing/unsubscribing to a topic.

I'll change the issue to reflect this.

@dpa99c dpa99c added legacy Related to inherited code/functionality runtime issue An issue related to app runtime TODO Something needs doing labels Jun 8, 2020
@dpa99c dpa99c changed the title How to check failed subscribe Indicate if subscribe/unsubscribe to topic failed Jun 8, 2020
@svenboogaarthotraco
Copy link
Author

@dpa99c Is there another way I can check if subscribe if succesffull, e.g. is it possible to get my subscribtions? If thats possible I can validate if the expected subscribe is succesfull. Is it correct there is a few minutes delay between subscribe and when you can actually receive the messages? When testing in an android emulator it takes a few minutes before I can actually send messages to a subscribed device. PS, is there a forum or something where I should ask question. I have the feeling i should not post it under issues.

dpa99c pushed a commit that referenced this issue Jun 26, 2020
…rom topics. Fully resolves #422.

Rationalise plugin result callbacks and error handling.
@dpa99c dpa99c closed this as completed in 833ea48 Jun 26, 2020
dpa99c added a commit that referenced this issue Jun 26, 2020
…ng from topics. Partially resolves #422.

Rationalise plugin result callbacks and handling of async task results.
dpa99c pushed a commit that referenced this issue Jun 26, 2020
…rom topics. Fully resolves #422.

Rationalise plugin result callbacks and error handling.
@dpa99c dpa99c removed the TODO Something needs doing label Jun 26, 2020
@Hao-Axon
Copy link

Hao-Axon commented Jul 7, 2020

@dpa99c I get "Task failed for unknown reason" error from .subscribe now. But seems like the subscribe is actually successful and the app can receive messages after the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy Related to inherited code/functionality runtime issue An issue related to app runtime
Projects
None yet
Development

No branches or pull requests

3 participants