Firebase同步XMLHttpRequest已弃用

编程入门 行业动态 更新时间:2024-10-22 19:47:13
本文介绍了Firebase同步XMLHttpRequest已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Firebase的ping服务使用Google Chrome报告的同步XMLHttpRequest,如下所示: $ b

主线程上的同步XMLHttpRequest是由于对最终用户的体验有不利影响而不推荐使用。如需更多帮助,请查阅 xhr.spec.whatwg/ 。 b $ b

这个问题的来源是: $ b $ pre $ .lp?dframe = t& id = 612050& pw = gcdpSrzjvk& ns = myapp:5

这是Firebase中的错误吗?这不是现在造成的问题。但在将来,浏览器可能会弃用同步的XHR。 解决方案

/ p>

您只有在关闭页面,浏览或刷新页面时才能看到它。

Firebase客户端选择一个同步XHR来告诉服务器,它正在断开连接。通过这种方式,服务器可以立即运行您在 onDisconnect()函数中指定的逻辑。否则,客户端必须依靠超时,这可能需要一两分钟的时间。

可能在页面刷新并且在控制台中挥之不去时会看到这个消息。 / p>

但是,没有什么可担心的,这是有意的,对您的应用程序也是无害的。

The ping service from Firebase is using Synchronous XMLHttpRequest which was reported by Google Chrome as follows:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check xhr.spec.whatwg/.

The source of this issue is coming from:

.lp?dframe=t&id=612050&pw=gcdpSrzjvk&ns=myapp:5

Is it a bug within Firebase? This isn't causing any issue for now. But in future, browsers may deprecate synchronous XHR.

解决方案

This error appears only for clients that fall back to long-polling.

You should only see it when you're closing the page, navigating away, or refreshing it.

The Firebase client choses to do a synchronous XHR to tell the server that it's disconnecting. This way the server can immediately run the logic you've specified on any onDisconnect() functions. Else, the client has to rely on a timeout, which can take a minute or two.

Likely you see this when the page refreshes and it's lingering in the console.

But, there's nothing to worry about, it's intentional and it's also harmless to your application.

更多推荐

Firebase同步XMLHttpRequest已弃用

本文发布于:2023-11-24 23:07:08,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Firebase   XMLHttpRequest   已弃用

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!