0
現在、私のウェブサイトにプッシュ通知を実装しようとしていますが、動的なタイトルとリンクを表示しようとしています。サービス作業とプッシュ通知
これあなたが見ることができるように私のサービスワーカーは現在
self.addEventListener('push', function(event) {
// console.log('[Service Worker] Push Received.');
// console.log('[Service Worker] Push has this data: ');
const title = event.data.title;
const options = {
body: event.data.text(),
}
const notificationPromise = self.registration.showNotification(title, options);
event.waitUntil(notificationPromise);
});
self.addEventListener('notificationclick', function(event) {
console.log('[Service Worker] Notification click Received.');
event.notification.close();
event.waitUntil(
clients.openWindow('https://developers.google.com')
);
})
どのようなものか、現在のリンクがハードコーディングされたdevelopers.google.comリンクで、タイトルに戻り「未定義の」が
これらをペイロードに送信するために、ウェブサイトのバックエンドから何かする必要がありますか?
場合、それは私が、私はこれは実際にあなたがJSONオブジェクトからタイトルデータにアクセスしているかの問題であると考えていWeb Push Library for C#