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:5Is 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已弃用
发布评论