Google推送通知 - DOMException:注册失败 - 推送服务错误

时间:2017-02-22 07:36:45

标签: google-chrome push-notification firebase-cloud-messaging

我正在尝试使用VAPID键在我的网站上启用推送通知。 当我包含 gcm_sender_id 并从 pushManager.subscribe 方法中删除 applicationServerKey 时,它运行正常。

仅当我启用VAPID密钥并从manifest.json文件中删除gcm_sender_id时。我得到了相应的错误。

DOMException: Registration failed - push service error

我正在使用Chrome浏览器。

1 个答案:

答案 0 :(得分:0)

我在pushManager.subscribe方法中使用的applicationServerKey在某种程度上是不正确的。 当我使用以下模块重新生成节点中的键时,它工作正常。

const webpush = require('web-push');
const vapidKeys = webpush.generateVAPIDKeys()