Google chrome Chrome中未显示Web推送通知

Google chrome Chrome中未显示Web推送通知,google-chrome,push-notification,notifications,Google Chrome,Push Notification,Notifications,目前我正在为我们的项目开发web推送通知服务。我面临的问题是,我在谷歌Chrome中的服务人员接收推送信号,但不会将其显示为通知,尽管我能够将数据记录到开发人员控制台。我在Firefox和其他设备的Chrome上试用了它,它确实有效。我试图恢复chrome设置,但没有帮助。这是我的服务人员代码: 'use strict'; self.addEventListener('push', function(event) { console.log('[Service Worker] Push Rec

目前我正在为我们的项目开发web推送通知服务。我面临的问题是,我在谷歌Chrome中的服务人员接收推送信号,但不会将其显示为通知,尽管我能够将数据记录到开发人员控制台。我在Firefox和其他设备的Chrome上试用了它,它确实有效。我试图恢复chrome设置,但没有帮助。这是我的服务人员代码:

'use strict';

self.addEventListener('push', function(event) {
console.log('[Service Worker] Push Received.');
console.log(`[Service Worker] Push had this data: "${event.data.text()}"`);

var payloadJson = JSON.parse(event.data.text());

const title = payloadJson.title;
const options = {
    body: payloadJson.message,
    icon: 'img/img.png',
    badge: 'img/img2.png'
};

event.waitUntil(self.registration.showNotification(title, options));
});
推送服务工作人员按预期记录消息后:

正如我提到的,我在chrome上用另一台设备测试了它,该设备有chrome v64,而mines是v65.0.3325.162,这两台设备都运行在Mac OS High Sierra 10.13.3上

编辑:
因此,我发现了一些奇怪的行为,在完全删除所有缓存文件并重新安装chrome之后,我能够让它工作,但现在的问题是,如果我等到通知解除,它将不会在下次显示。在我单击“通知关闭”之前,一切正常。

要发送通知,有效负载必须使用:


查看以下答案:

您找到解决方案了吗?
var payload = {
    notification: {
        title: 'My Title',
        body : 'TEST'
    }
};