-
-
Notifications
You must be signed in to change notification settings - Fork 67
Unable to send priority 10 due to validation check #172
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
Comments
Thanks for opening this issue! |
The default priority is 10 so no need to change it. |
@dplewis Ok I will not send priority 10 but if you send it the request fails. In case you want to evaluate a correction in that validation. Close the issue |
If the request fails then that’s an issue, looks like this check prevents the default from being passed too but I’m not sure |
From the APN docs: https://developer.apple.com/documentation/usernotifications/sending-notification-requests-to-apns: The priority of the notification. If you omit this header, APNs sets the notification priority to 10. So the value of |
Though the broadcast docs doesn't specify this default behavior, https://developer.apple.com/documentation/usernotifications/sending-broadcast-push-notification-requests-to-apns So it's best to allow it to be set by the developer. @MarmolDevApps you may want to reopen the issue. |
If set priority 10 the request throw error 'BadPriority'. I'm reopening the issue in case you want to modify it. Thanks for the quick response. |
Can you elaborate on this? Are you saying if The priority of the notification.
Specify 10 to send the notification immediately.
Specify 5 to send the notification based on power considerations on the user’s device.
Specify 1 to prioritize the device’s power considerations over all other factors for
delivery, and prevent awakening the device. In addition, the APN documentation shows an example of using a priority of |
Sorry, I'll go into more detail. Exactly, at least in broadcast sending the apns-priority header is mandatory but when building the headers in a notification in the priority part if something other than 10 is sent the apns-priority header is set but if it is 10 it is not sent and the error is executed. Therefore, whether we set it or not from our side, if it is 10 it throws an error, at least the broadcast method. (By default you have 10 in the notification and it does not enter the validation and does not set the header). on line 71 of notification/index.js if (this.priority !== 10) {
headers['apns-priority'] = this.priority;
} |
I see, so #173 should resolve this issue |
🎉 This change has been released in version 6.4.3 |
Thanks so much @cbaker6 ! It's working now |
I'm unable to send priority 10 in the request because of the following validation on line 71 of
notification/index.js
fileThis check prevents sending the priority when it is 10, as it only sets the apns-priority header when the priority is different from 10. However, the server accepts priority 10, and I need to find a way to send this value correctly.
I am implementing the new broadcast functionality and need to send updates with priority 10.
Thanks for the quick support.
The text was updated successfully, but these errors were encountered: