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

查看:107
本文介绍了我们可以在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 Push通知(截至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通知的最佳方法.我知道,这对开发人员而言不是那么好:)希望苹果公司加快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

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天全站免登陆