web-push-libs / pywebpush

Python Webpush Data encryption library
Mozilla Public License 2.0
314 stars 53 forks source link

No error thrown, but no push notifications received #165

Closed N3RDIUM closed 4 months ago

N3RDIUM commented 4 months ago

Hey there. I am using the pywebpush.webpush() func to send push notifications and apparently it throws no error and runs successfully, but no client is receiving push notifications. What's happening?

Thanks, n3rdium

jrconlin commented 4 months ago

There can be a lot of reasons, sadly.

When you say "no error", you mean that sending a message using the pywebpush CLI didn't throw an exception, right?

Sadly, all that means is that the Endpoint URL for the subscription was correct.

I might be able to help if I know: 1) What system are you using? (Are you sending this to a user agent on Mozilla, Google, Apple, Microsoft, ??) 2) Is this a mobile device or a desktop one? 3) How are you specifying the endpoint credentials? (for that matter, how did you get them?) 4) Are you using VAPID to sign the request?

Normally, Endpoint credentials are provided in the Javascript by the PushManager.getSubscription() call You can call toJson() on the subscription object to get data you can store in the --info subscription_info.json block. (It's important that you have the right subscription info, since each endpoint will have a unique endpoint and keys).

The browser may reject the message if it can't decrypt the data. I know that Firefox displays this in the Browser Console (which is different than the Web Developer Console). I'm not sure if Chrome or Edge provide that feature, but I'm sure you can look around and find it.)

N3RDIUM commented 4 months ago

Somehow got it to work, now its working fine. Thanks for the help!

Thanks, N3RDIUM