gpt4 book ai didi

javascript - 我可以将 service worker 与 socket-io 一起使用吗?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:45:39 26 4
gpt4 key购买 nike

我想将通知推送到桌面和移动设备。为此,我关注这篇文章:https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en

我有两个问题:

  1. 我可以在所有标签页关闭后(Chrome 重启吗?)使用推送通知发送通知
  2. 我可以使用 socket.io 来触发通知吗?例如 io.on('message') 而不是 GCM?<

最佳答案

两个问题,两个答案:


Can I use push notification to send notification after all tabs are closed (Chrome restart?)

是的。在 Chrome 关闭后,可以为桌面版 Chrome 和 Android Chrome 发送通知。使用通知 API。


Can I trigger the notification by using socket.io for example io.on('message') instead of GCM?

没有。 Service Worker 不在后台工作,而浏览器/选项卡已关闭。唤醒 service worker 的唯一方法是使用 GCM。

关于javascript - 我可以将 service worker 与 socket-io 一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37390698/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com