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

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

问题描述

来自 Firebase 的 ping 服务使用的是 Synchronous XMLHttpRequest,Google Chrome 报告如下:

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

主线程上的同步 XMLHttpRequest 被弃用,因为其对最终用户体验的不利影响.如需更多帮助,检查 http://xhr.spec.whatwg.org/.

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/.

这个问题的来源来自:

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

这是 Firebase 中的错误吗?这暂时不会造成任何问题.但将来,浏览器可能会弃用同步 XHR.

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.

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

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.

但是,没有什么可担心的,它是故意的,而且对您的应用程序也无害.

这篇关于Firebase 同步 XMLHttpRequest 已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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