web-push-libs / web-push-php

Web Push library for PHP
MIT License
1.7k stars 295 forks source link

$report->isSuccess() always returns true with web.push.apple.com #382

Closed JoJoAction closed 7 months ago

JoJoAction commented 8 months ago

Hello there, thank you @Minishlink for this code. Generally, it works very well.

Just one problem with notifications sent to web.push.apple.com:

In general, sending notifications to web.push.apple.com works fine. But:

$report->isSuccess() always returns true, even if the subscription has gone (because the user unsubscribed).

Is there a way to fix this? Best regards!

Rotzbua commented 8 months ago

$report->isSuccess() always returns true, even if the subscription has gone (because the user unsubscribed).

isSuccess() is true if it was successful submitted and confirmed by the server. Is may not represent the current subscription status because of caching, lack of unsubscribe or privacy protection.

JoJoAction commented 8 months ago

Thank you for your feedback.

I just explicitly unsubscribed from three different subscriptions, to endpoints at wns2-am3p.notify.windows.com, fcm.googleapis.com and web.push.apple.com. Aferwards, I used this code to send a notification to all three.

Whilst isSuccess() returned false for am3p.notify.windows.com and fcm.googleapis.com (as it should), it returned true for web.push.apple.com (which is not correct).

So this seems to be an issue only for endpoints at web.push.apple.com.

Rotzbua commented 8 months ago

If web.push.apple.com does still return a 201 and not a 410 status code then there is nothing what this library can do. If you unsubscribe correctly then it seems a bug on apples side. Their documentation do not mention different behavior: https://developer.apple.com/documentation/usernotifications/sending_web_push_notifications_in_web_apps_and_browsers

JoJoAction commented 7 months ago

If web.push.apple.com does still return a 201 and not a 410 status code then there is nothing what this library can do. If you unsubscribe correctly then it seems a bug on apples side. Their documentation do not mention different behavior: https://developer.apple.com/documentation/usernotifications/sending_web_push_notifications_in_web_apps_and_browsers

Thank you! I just wanted to be sure if this is a bug on Apple's side, not on this library's side. If it is indeed Apple's fault, then of course there is nothing this library can do about it.

Thank you for your quick response anyway.