【问题标题】:Can I use service worker with socket-io?我可以将 service worker 与 socket-io 一起使用吗?
【发布时间】:2016-09-20 07:36:08
【问题描述】:

我想将通知推送到桌面和移动设备。为此我关注了这篇文章: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)来触发通知吗?

【问题讨论】:

    标签: javascript android google-chrome push-notification google-cloud-messaging


    【解决方案1】:

    两个问题,两个答案:


    我能否在所有标签页关闭后使用推送通知发送通知(Chrome 重启?)

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


    我可以使用 socket.io(例如 io.on('message') 代替 GCM 来触发通知吗?

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

    【讨论】:

      猜你喜欢
      • 2018-06-25
      • 2018-07-09
      • 2020-04-24
      • 2020-10-11
      • 2011-10-03
      • 1970-01-01
      • 2023-03-25
      • 2020-08-04
      • 2018-10-23
      相关资源
      最近更新 更多