Pushpad
Articles › Push Subscriptions, Web Push Notifications

Difference between PushManager subscribe and getSubscription

  • # push-api

These two methods defined by the Push API are used to get the push subscription from the browser. What is the difference between them?

The answer is simple:

Note that PushManager.subscribe() may trigger a permission prompt, if the user has not allowed the notifications yet, while PushManager.getSubscription() will never trigger it.

If you use Pushpad for web push notifications you don't need to call these methods directly: you can use the JavaScript SDK instead, which offers useful methods and an higher level of abstraction.