Google推送通知 - DOMException:注册失败 - 推送服务错误
问题描述:
我试图使用VAPID键在我的网站上启用推送通知。 当我包括gcm_sender_id并从pushManager.subscribe方法删除applicationServerKey它运行良好。Google推送通知 - DOMException:注册失败 - 推送服务错误
只有当我启用VAPID键并从manifest.json文件中删除gcm_sender_id时。我得到以下错误。
DOMException: Registration failed - push service error
我正在使用Chrome浏览器。
答
我在pushManager.subscribe方法中使用的applicationServerKey有点不正确。 它在我使用以下模块重新生成节点中的密钥时起作用。
const webpush = require('web-push');
const vapidKeys = webpush.generateVAPIDKeys()