mercredi 9 novembre 2016

How to get Endpoint for a Subscriber in web push notification?

I'm following this exercise to enable web push notification:

https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/

in the part that permit notification suppose to subscribe a user changing "User NOT Suscribed" to "User IS Subscribed" and get an ID . But the problem is that don't changing to "User IS subscribed" and i don't find the error :(, How to get Endpoint for a Subcriber in web push notification ?

This is how to show in devtools

this is the code to subscribe a user that is located in "main.js"

 // Set the initial subscription value
  swRegistration.pushManager.getSubscription()
  .then(function(subscription) {
    isSubscribed = !(subscription === null);

    updateSubscriptionOnServer(subscription);

    if (isSubscribed) {
      console.log('User IS subscribed.');
    } else {
      console.log('User is NOT subscribed.');
    }

    updateBtn();
  });
}




Aucun commentaire:

Enregistrer un commentaire