Skip to content

Instantly share code, notes, and snippets.

@bwindels
Last active March 26, 2021 13:06
Show Gist options
  • Select an option

  • Save bwindels/f906029dd174d867964b41225a4c5b8b to your computer and use it in GitHub Desktop.

Select an option

Save bwindels/f906029dd174d867964b41225a4c5b8b to your computer and use it in GitHub Desktop.
Things I learned about web push & notifications
  • after a push message, you always need to have a notification open (could be one that already existed before the push message though), if not the browser will show one with the title "this site has been updated in the background" and tag user_visible_auto_something see https://goo.gl/yqv4Q4.
  • you can't replace notifications, and closing them can cause the issue above, so AFAICT, it's best to just leave notifications open until they are clicked. The above can still happen if you receive a push notification that should not update the notifications after you have clicked the visible one (e.g. for matrix when unread is updated)
  • all browsers I've tested only show the last notification you opened, I think even when self.registration.getNotifications returns more than one.
  • on firefox, chromium on linux and chrome on android, the notification options silent, renotify and requireInteraction didn't seem to have any effect at all.
@bwindels
Copy link
Copy Markdown
Author

@bwindels
Copy link
Copy Markdown
Author

bwindels commented Mar 26, 2021

you can only have the last push message delivered of all missed ones using the Topic header: https://hacks.mozilla.org/2016/11/mozilla-push-server-now-supports-topics/

@bwindels
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment