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

Improve example robustness #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mrwonko
Copy link

@mrwonko mrwonko commented Nov 6, 2023

While trying the example, I ran into a couple of issues, which I've addressed here:

  • the subscription gets printed with a wrapper that the backend does not understand
  • the backend does not handle errors gracefully
  • printing the subscription to the console makes it inaccessible on mobile

The backend expects the raw subscription, not one wrapped in an extra object.
By printing it without the wrapper, we make it easier for users to do the right
thing.
Added missing code block language.
When testing push notifications on the phone, the JS console isn't readily
accessible. So in addition to printing to the console, print progress updates
to the page itself.
Sanity check the parsed JSON by checking for the presence of the Endpoint, and
not ignoring potential parse errors.

Log errors.

See SherClockHolmes#56 for an example of where this would have been useful.
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

Successfully merging this pull request may close these issues.

1 participant