Firebase - 当 websockets 被公司代理/防火墙阻止时,是否有强制长轮询的标志? [英] Firebase - Is there a flag to force long polling when websockets are blocked by corporate proxy/firewall?

查看:25
本文介绍了Firebase - 当 websockets 被公司代理/防火墙阻止时,是否有强制长轮询的标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的企业 AngularJS 应用,并计划在后端使用 Firebase.

I'm developing a simple corporate AngularJS app and was planning on using Firebase for the backend.

我必须支持的浏览器是 IE8 和 Chrome(最新).

The browsers I have to support are IE8 and Chrome (latest).

我已经设法修复了前端中所有与 IE 相关的怪癖,并且可以成功地从我的 Firebase 检索数据.由于 IE8 不支持 WebSockets,我假设它使用的是长轮询.(这在性能方面很好,应用程序非常简单,只需提取/更新两到三个数据.

I have managed to fix all of the IE related quirks in the front end and can successfully retrieve data from my Firebase. As IE8 does not have support for WebSockets I assume it is using long polling. (this is fine performance-wise, the app is very simple and just pulls/updates two or three pieces of data).

矛盾的是,我在 Chrome 中反复看到以下错误,并且无法连接到 Firebase.我假设这是由于公司网络的防火墙/代理造成的.

Paradoxically, I am seeing the following error in Chrome repeatedly and it is failing to connect to Firebase. I am assuming this is due to the firewall/proxy of the corporate network.

WebSocket connection to 'wss://xxx.firebaseio.com/.es?v=5' failed: WebSocket is closed before the connection is established.

我无法控制防火墙/代理,所以我的问题是我是否可以强制 Chrome 也使用长轮询,在创建 Firebase 引用时使用某种配置标志?

I have no control over the firewall/proxy, so my question is if I can force Chrome to use long polling too, using some sort of config flag when I create my Firebase reference?

我混合使用了 Angularfire 和直接的 Firebase.该应用程序在 IE 中运行良好,因此我的代码似乎没有任何问题.(同样简单的测试脚本也遇到同样的问题)

I am using a mix of Angularfire and straight Firebase. The app works perfectly in IE so there does not appear to be anything wrong with my code. (Also simple test scripts encounter the same issue)

更新:该应用程序在 Chrome 中不起作用(因此是我的问题),所以这也许是我应该使用 Firebase 提出的错误,但无论如何强制长轮询的方法都可以(大概)修复我的问题.

Update: The app does not work in Chrome (hence my question), so perhaps this is a bug I should raise with Firebase, but regardless a way to force long polling would (presumably) fix my issue.

推荐答案

你可以使用 Firebase.INTERNAL.forceLongPolling(); 强制长轮询 Firebase.INTERNAL.forceWebSockets(); 强制网络套接字

you can use Firebase.INTERNAL.forceLongPolling(); to force long polling Firebase.INTERNAL.forceWebSockets(); to force web socket

这篇关于Firebase - 当 websockets 被公司代理/防火墙阻止时,是否有强制长轮询的标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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