首先,我想说我一直在研究推送通知和网络通知,但我有点困惑。
我从这里了解到 PWA 的推送通知不适用于 Safari 上的 iOS (iPhone):Sending Push Notifications to iOS from PWA
但这是否意味着如果 iPhone 用户使用 Chrome,它们就可以工作?或者推送通知不适用于任何浏览器上 iPhone 中的 PWA?
这让我看到了网络通知。 Web 通知是否适用于后台 PWA?我的问题是 Web 通知是否足以替代推送通知,或者 Web 通知是否无法由服务器触发,因此推送通知仍然是必要的?
最佳答案
Do web notifications work for PWAs in the background?
是的,即使网站关闭,它们也会在后台工作,这要归功于服务人员。
当收到推送信号时,服务工作线程将被激活并调用 JavaScript 回调。
are web notifications a good enough substitute for push notifications
Web 通知与在后台传递消息的 W3C Push API 一起,是真正的推送通知,即使在网站关闭时也可以传递。
is it that Web notifications cannot be triggered by a server and thus push notifications are still necessary?
是的,可以使用 Push API 和 WebPush 协议(protocol)从您的服务器在后台触发网络推送通知。
does it mean that they work if the iPhone user is using Chrome?
目前(2021 年第一季度),iPhone 不支持在任何浏览器上进行网络推送。
关于android - PWA 的推送通知或 Web 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66625015/