Service Worker 与 Web Worker [英] Service Worker vs Web Worker
问题描述
我想为我的网站实施推送通知:考虑我们有一个购物网站,每当用户点击一个产品时,服务器应该向产品的所有者推送通知,该用户(例如 John)想要购买您的鞋子.(即时的).
I wanna implement push notification for my website: Consider we have a shopping site, whenever a user click on one product, the server should push notification to the owner of the product that user (for example John) wants to buy your shoe. (real-time).
我读过一些关于 web worker(比如 socket.io)和 service worker 的文章,我认为 service worker 是最好的选择.我是真的吗?如何实施推送通知?
I have read some articles about web worker (like socket.io) and service workers, I conclude that service workers are the best choice. Am I true? How can I implement that push notification?
推荐答案
Service Worker 是一种特殊的 Web Worker.为了实现 Web 推送通知,使用 Service Workers 是一个不错的选择(不适用于 Safari!).有一篇很棒的文章解释了如何实施它.
A Service Worker is a special kind of Web Workers. For implementing Web Push Notifications, it's a good choice to use Service Workers (does not work for Safari!). There is a great article explaining how to implement it.
这篇关于Service Worker 与 Web Worker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!