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

Unable to subscribe to a channel #65

Open
billymedia opened this issue Jun 22, 2015 · 5 comments
Open

Unable to subscribe to a channel #65

billymedia opened this issue Jun 22, 2015 · 5 comments

Comments

@billymedia
Copy link

I have it installed and registering ok in android / cordova 3 / angular 1.3.6 / parse js sdk 1.4.1.

Once registered, i have a toggle that allows the user to subscribe/unsubscribe to a channel.
I am unable to subscribe to a channel, there is no error returned.

This is my subscribe code :

                parsePlugin.subscribe('user_123', function() {
                    console.log('PN complete'); // i can see this in the console, yet channels in parse.com is empty
                }, function(e) {
                    console.log('PN1 ERROR',e);
                });

As i can register, i assume the plugin is installed ok and connecting to parse.com with the app id and client key. Can you think of a reason why it wont subscribe?

Note that I did not implement the "Android Quirk" as it threw an error on cordova build, but i can see in a pull request that this is no longer needed.

@vineshhpatel
Copy link

Having same issue. I even get the success callback called.

@billymedia
Copy link
Author

I have ended up subscribing/unsubscribing manually via Parse queries:

parsePlugin.initialize(*APP_ID*,*CLIENT_KEY*, function() {
    parsePlugin.getInstallationId(function(id) {
        var installationQuery = new Parse.Query(Parse.Installation);
        installationQuery.equalTo('installationId', id);
        return installationQuery.first().then(function(installation) {
            installation.set('channels', ['user_123']);
            installation.save();
        });
    }, function(e) {
        console.log('ID ERROR',e);
    });
}, function(e) {
    console.log('INIT ERROR',e);
});

@anteksiler
Copy link

@billymedia Hi there, where can read about installation.set and save methods?

@MarcBT
Copy link

MarcBT commented Aug 13, 2015

@anteksiler
These methods come from BackboneJS which is used by Parse JS SDK.

@dcdrns
Copy link

dcdrns commented Dec 22, 2015

I had this same problem.
This plugin -> https://github.com/denisbabineau/phonegap-parse-plugin solved my problem.
Use following command to install the plugin.
cordova plugin add https://github.com/denisbabineau/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY --variable JS_KEY=PARSE_JS_KEY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants