Firebase同步XMLHttpRequest已弃用 [英] Firebase Synchronous XMLHttpRequest Deprecated

查看:221
本文介绍了Firebase同步XMLHttpRequest已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


主线程上的同步XMLHttpRequest是由于
对最终用户的体验有不利影响而不推荐使用。如需更多帮助,请查阅 http://xhr.spec.whatwg.org/
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 http://xhr.spec.whatwg.org/.

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已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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