[w3c/push-api] A subscription with a different application server key already exists. (#296)

I meet an error that when I use ``pushManager.subscribe()`` on my phone (Firefox 60.0.1)

````
A subscription with a different application server key already exists.
````

It works on my laptop(Firefox 60.0.1) ,even my roommate's computer(Firefox 60.0.1),heres my code

````
  if('PushManager' in window){
    navigator.serviceWorker.ready.then((swReg) => {
      console.log('PushManage registration success')
      swReg.pushManager.getSubscription().then(function(subscription){
        if(subscription){
          console.log(subscription)
        }else{
          console.log('start subscribe')
          swReg.pushManager.subscribe({
            userVisibleOnly:true,
            applicationServerKey:urlBase64ToUint8Array('xxxxx')
          }).then((res)=>{
            api.subscription({data:JSON.stringify(res)})
          }).catch(e=>{
            console.log('error:'+e)
          }).finally(()=>{
            console.log('gg')
          })
        }
      })
    })
  }
````

I have tried change my applicationServerKey ,didn't work.

ask for help

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/296

Received on Tuesday, 22 May 2018 03:00:46 UTC