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

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

问题描述

我正在开发一个简单的公司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.

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

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和Straight 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-当Websocket被公司代理/防火墙阻止时,是否存在强制长时间轮询的标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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