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

APN Feedback Service not working #331

Open
KirbySSmith opened this issue Feb 8, 2018 · 0 comments
Open

APN Feedback Service not working #331

KirbySSmith opened this issue Feb 8, 2018 · 0 comments

Comments

@KirbySSmith
Copy link

Affected Version: 3.3.0

The configuration of the Feedback Service does not work with documented raix config.
certData and keyData are nested under options.apn.certData and options.apn.keyData.
https://github.com/raix/push/blob/v3.3.0/lib/server/push.api.js#L242

            var feedbackOptions = {
                'batchFeedback': true,

                // Time in SECONDS
                'interval': 5,
                production: !options.apn.development,
                cert: options.certData,
                key: options.keyData,
                passphrase: options.passphrase
            };

            var feedback = new apn.Feedback(feedbackOptions);

So it should be:

            var feedbackOptions = {
                'batchFeedback': true,

                // Time in SECONDS
                'interval': 5,
                production: !options.apn.development,
                cert: options.apn.certData,
                key: options.apn.keyData,
                passphrase: options.passphrase
            };

            var feedback = new apn.Feedback(feedbackOptions);

Making this change fixes the configuration. However, once configured properly an additional downstream error is thrown. The on 'feedback' callback function is not bound to the meteor environment.

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.

https://github.com/raix/push/blob/v3.3.0/lib/server/push.api.js#L254

            feedback.on('feedback', function (devices) {
                devices.forEach(function (item) {
                    // Do something with item.device and item.time;
                    // console.log('A:PUSH FEEDBACK ' + item.device + ' - ' + item.time);
                    // The app is most likely removed from the device, we should
                    // remove the token
                    _removeToken({
                        apn: item.device
                    });
                });
            });
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

1 participant