Chromeで通知を受け取るサービスワーカーは ですが、Firefoxでは受信できません。Google Cloud Messaging(GCM)がFirefoxと連携していません
プッシュリスナーは(それをデバッグすることで)Firefoxでは全く発生しません、
PS:サービスワーカーが正常に登録されているが、それは通知を受けていません。
私のコードの問題点は何ですか?新しいメッセージチャネル(MessageChannel.MessageChannel()
)を設定サービスワーカー、とcomunicateおよびサービスワーカーにWorker.postMessage()
を呼び出すことにより、サービスワーカーにポート2を介して送信するChannel Messaging APIを使用している場合は、このdocumentationから基づい
self.addEventListener('install', function (event) {
event.waitUntil(self.skipWaiting());
});
self.addEventListener('activate', function (event) {
console.log('Activated', event);
});
self.addEventListener('push', function (event) {
event.waitUntil(
fetch('/path', {
credentials: 'include',
method: 'post',
})
.then(function (response) {
return response.json()
.then(function (data) {
return self.registration.showNotification(data.title, {
body: data.body,
icon: '/images/image.png',
});
});
})
.catch(function (error) {
console.error('wrong', error);
})
);
});
私は通知のためのgoogle gcmのドキュメントを使用しています。私はそれをFirefoxと統合したいと思います。 https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=ja –