w3c / push-api

Push API
https://w3c.github.io/push-api/
Other
145 stars 40 forks source link

Unsubscribe rest url #242

Closed publicocean0 closed 7 years ago

publicocean0 commented 7 years ago

How is possible to unsubscribe a user agent from server sending notifications ?

martinthomson commented 7 years ago

You need to ask the user agent to unsubscribe for you using unsubscribe(). Otherwise, this is a protocol question.

publicocean0 commented 7 years ago

I wrote server not client. sorry i dont understand . https://w3c.github.io/push-api/#dom-pushsubscription-unsubscribe is javascript api in the client.

I have the endpoint serverkey vapid_private vapid_public saved in the server for every user agent.

I m in the java application server! how to unsubscribe a user agent to that subscription?

martinthomson commented 7 years ago

None of those things is sufficient to remove the subscription. Only the client has the credentials that can remove that.

The information that an application server has is not special here. Multiple application servers can have access to the same subscription (though this is rare in practice, it is expressly enabled by the design). This means that no single application server can terminate the subscription. They can only ask the client to do that.

If you are not interested in using the subscription, you can also drop the information about the endpoint and stop using it. It doesn't cost a push server much to maintain the record that isn't used.

publicocean0 commented 7 years ago

Thanks for the clarification . I accepted this solution for my server . Anyway I don't agree with this design . If many apps can share a subscription , design might register application ids associated with it. A removal call will remove just the specific id . In this way push server can also know when a subscription record is useless .