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

Include subscription in WebPushException #5

Closed
marsimoto03 opened this issue Feb 14, 2017 · 6 comments
Closed

Include subscription in WebPushException #5

marsimoto03 opened this issue Feb 14, 2017 · 6 comments
Assignees
Milestone

Comments

@marsimoto03
Copy link

marsimoto03 commented Feb 14, 2017

Hi!

This is more a feature request than an issue.
In the case that a stored subscription is not valid any more I get a WebPushException with status code "Gone", but at that moment I don't now to which subscription it relates to. So I'm not able to delete it from my database and will get this exception again and again. Therefore it would be great to provide the subscription via the WebPushException.
What you think about it?

Edit: I have troubles using Web Push with VAPID and payload on Firefox (v. 46.xx). On Chrome I receive the notification with data without any issues but when sending to Firefox I get a "NotFound" within a WebPushException. I tried to debug it, but there isn't any hint I could find. Do you/anybody have tips for that matter?

Thank you!

@coryjthompson
Copy link
Member

Do you have an example of what url are trying to hit in Firefox?
If you were hitting the correct url and the keys were invalid you would receive an Unauthorized.

Thanks for your suggestion regarding adding push subscription details in WebPushException.

@marsimoto03
Copy link
Author

marsimoto03 commented Feb 16, 2017

Sure. Since I used VAPID I got a mozilla endpoint wiht "/v2" i assume. So this is my subscription object:
{ "endpoint": "https://updates.push.services.mozilla.com/wpush/v2/gAAAAABYpESkITzRdLfq5LgF5bTmlKEGv4-LJXtNWVKmYeO9gQhUvvOQjeQKVSDRy-mVbl4g0WroU9XpsSOANHmSyUZaeBKWgyQ6v3hSas5TZRGhG9EFQwiQuCe_f4-MIgk9thBXMKlsUP_nYWUOEu6Ba4fB_VLxH1u5V6ErYvM5647sWQHVmek", "keys": { "p256dh": "BIhG9_nTy0BcXIdEHMVy0bNIMcHL4WGCyC6ETqdGZffMsBzIMBSQaK-7k4PxpxaZu5HK5rvKx-16_yvlJOH67vU", "auth": "DPmRynzG9ijct7znNLEKgw" } }
So I use my generated VAPID application server key to subscribe. In Chrome it works so I thought I should work the same using Firefox.
Thank you for your help!

@coryjthompson
Copy link
Member

That looks correct to me - are you sending a payload? If not, can you try sending an arbitrary string as the payload. If that fails would you mind sharing code?

@marsimoto03
Copy link
Author

Yes, I send some payload with it - an object containing data that was stringified for sending.
I will try just sending a string, but you will have to wait for my response till monday because I'm not at work today.

@marsimoto03
Copy link
Author

So I looked into it and it was totally my mistake. In the past I saved the subscription object (in this case the endpoint) in the database without the trailing "push vendor url" (like https://updates.push.services.mozilla.com/wpush/v2/). With the use of your library I had to concatenated the url to the device key when sending a push notification and therefore I decided to save the whole endpoint url in the database. But my code still concatenated the url to the so I ended up with https://updates.push.services.mozilla.com/wpush/v2/https://updates.push.services.mozilla.com/wpush/v2/gAAAAABYpESkITzRdLfq5... . Google / FCM is be able to handle it. I debugged it before but I didn't notice it.

Thanks again for your help and I'm looking forward to the detailed WebPushException (I saw you already implemented it)!

@coryjthompson
Copy link
Member

You're welcome, thank for the update.

@coryjthompson coryjthompson added this to the 1.0.9 milestone Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants