phonegap-parse-plugin icon indicating copy to clipboard operation
phonegap-parse-plugin copied to clipboard

Unable to subscribe to a channel

Open billymedia opened this issue 10 years ago • 5 comments

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.

billymedia avatar Jun 22 '15 00:06 billymedia

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

vineshhpatel avatar Jun 22 '15 10:06 vineshhpatel

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);
});

billymedia avatar Jun 22 '15 10:06 billymedia

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

anteksiler avatar Jul 27 '15 19:07 anteksiler

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

MarcBT avatar Aug 13 '15 10:08 MarcBT

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

dcdrns avatar Dec 22 '15 06:12 dcdrns