我最近刚刚了解 VAPID,并一直在寻找它存在的原因及其目的。 Mozilla's blog post解释说“如果我们发现问题,包含 VAPID 信息可以让我们联系您”,但我不太确定他们的意思。他们是否进行某种监控以防止其他人模仿您的服务?
最佳答案
VAPID specification的摘要解释了一切:
An application server can voluntarily identify itself to a push service using the described technique. This identification information can be used by the push service to attribute requests that are made by the same application server to a single entity. This can used to reduce the secrecy for push subscription URLs by being able to restrict subscriptions to a specific application server. An application server is further able to include additional information that the operator of a push service can use to contact the operator of the application server.
所以 VAPID 有两个原因。
第一个是将订阅的有效性限制到特定应用程序服务器(因此,通过使用 VAPID,只有您的服务器能够向订阅者发送通知)。
第二个是在推送通知中添加更多信息,以便推送服务运营商知道谁在发送通知。如果您的通知出现问题,接线员会知道您是谁并可以与您联系。此外,他们可以为您提供某种界面来监控您的推送通知。
关于web-push - 什么是 VAPID?它为什么有用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40392257/