我可以在没有通知许可的情况下使用Firebase云消息传递吗? (Javascript) [英] Can i use firebase cloud messaging without notification permission? (Javascript)

查看:55
本文介绍了我可以在没有通知许可的情况下使用Firebase云消息传递吗? (Javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:Google错误报告说明

(正如Google开发人员倡导者在对答案1的评论中所建议的那样,提交了一个错误报告;在此更新了内容,因为它更简洁,准确地描述了问题)

(as suggested by google dev advocate in comments on answer 1, filed a bug report; updating the content here since it more succinctly and precisely describes the problem)

我不需要或不想向我的用户显示任何通知.而且许多用户不愿意授予通知权限,因为他们认为自己将开始看到通知.

I do not need or want to show any notifications to my user. And many users are not willing to give notifications permission because they assume they will start seeing notifications.

但是我希望将数据从服务器推送到我的网页.该网页处于活动状态并且处于前台.这是Web套接字设计的经典用例.

But I wish to push data to my web page from the server. The web page is active and in the foreground. This is the classic use case that Web Sockets were designed for.

我了解我可以编写自己的Web套接字服务器并以某种方式尝试对其进行扩展,或者与其他第三方合作以获取外包的可扩展Web套接字推送解决方案.

I understand that I could write my own web socket server and somehow try to scale it, or go to some other third-party for an outsourced scalable web socket push solution.

但是,这不是Firebase Messaging所针对的消息传递中非常常见的子用例"吗?因此,Google不应该支持该用例吗?我看不到任何基本的技术支持者,但是由于Google非常聪明,如果我对为什么不能做到或不应该做到这一点有所遗漏,请给我以启发.

But, isn't this is a very common "sub-use-case" of the messaging that Firebase Messaging is targeted towards? Therefore shouldn't Google support this use case? I can't see any fundamental technical show-stoppers, but since Google is so smart, please do enlighten me if I am missing something on why this cannot or should not be done.

原始StackOverflow问题文本:

我不需要后台通知或服务人员.我想要的只是将数据加载到当前网页中并且在前台时将其发送到该网页.

I don't need background notifications or service workers. All I want is to send data to the web page when it is currently loaded and in the foreground.

Websockets不需要任何许可,但需要Websocket服务器和维护.缩放它很困难或很昂贵.

Websockets do not need any permission but they need a websocket server and maintenance. It is difficult or expensive to scale it.

Firebase从根本上解决了问题,但是我不明白为什么即使我只想在加载页面时推送数据,为什么也必须要求用户授予通知权限;为什么?不在后台.

Firebase solves the problem fundamentally but I don't see why it must require a user to give notifications permission even though I only want to push data when the page is loaded; not in the background.

推荐答案

问题是Firebase Messaging仅使用一种方法来传递通知.那就是Push API规范规范,并且该规范(错误和不幸的是)不允许服务工作者在用户未允许不相关许可 show 通知的情况下接收消息.

The problem is that Firebase Messaging is only using 1 method to deliver notifications. That is the Push API specification spec, and that specification (wrongly and unfortunately) does not allow a service worker to receive messages without the user allowing an unrelated permission to show notifications.

此修复程序将使Firebase Messaging团队提供一种将消息传递到活动网页的不同方式-长轮询或websocket.

The fix would be for the Firebase Messaging team to provide a different way to deliver messages to active web pages -- long polling, or websockets.

但这对他们来说将是额外的工作,并且可能没有足够的人提出要求.

But it would be extra work for them, and may be not enough people are requesting it.

这篇关于我可以在没有通知许可的情况下使用Firebase云消息传递吗? (Javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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