我们可以在 ios serviceworker 上运行 firebase 实时监听吗? [英] Can we run firebase realtime listening on ios serviceworker?

查看:29
本文介绍了我们可以在 ios serviceworker 上运行 firebase 实时监听吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 iOS 11.3 开始支持 serviceworker 功能

As of iOS 11.3 there is serviceworker feature supported

即使它不支持通知.我想知道是否可以只运行任何实时侦听器(例如 firebase 数据库)来接收实时数据并使用 ServiceWorkerRegistration.showNotification 来显示本地通知

Even though it has no support for notification. I wonder if it possible to just run any realtime listener, such as firebase database, to receive realtime data and use ServiceWorkerRegistration.showNotification to show local notification instead

有可能吗?

推荐答案

虽然 iOS 不支持 Web 推送通知然而(截至 2018 年 4 月),您所能做的就是为来自服务器端的数据(在您的情况下为 Firebase)提供一个事件侦听器,并接收该数据以将其显示为通知/警报或您想要的任何方式显示在您的应用程序中(不在 iOS 通知区域中).

While iOS don't support Web Push notifications yet(as of Apr-2018), all you can do is have an event listener for data from server side(Firebase in your case) and receive that data to show it as an Notification/alert or how ever you want to present inside your application(not in iOS notification area).

不幸的是,这是处理 iOS 通知的最佳方式.我知道,它对开发人员来说并不是那么好:) 希望 Apple 在 PWA 上加快速度.他们比服务工人党本身晚了一年多.期待什么!

Unfortunately, this is the best way you can handle notifications for iOS. I know, its not so great for developers :) Hope Apple speeds up on PWA. They are more than a year late to Service worker party itself. What to expect!

更新:关于 WhatWebCanDo.today来自 Apple 的一个 表示 iOS-Safari 不支持推送通知w3c 定义的网络标准.但看起来有可用的 OS X safari 专有解决方案.

Update : One more link on WhatWebCanDo.today and one from Apple which says iOS-Safari don’t support push notification as a web standard defined by w3c. But looks like there is a OS X safari proprietary solution available.

这篇关于我们可以在 ios serviceworker 上运行 firebase 实时监听吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆