在角度离子应用,Android和iphone

时间:2015-10-05 17:32:04

标签: cordova firebase ionic angularfire

我尝试获取一个firebase对象,并且该请求在一半的时间内运行良好,但有时非常慢并且永远不会终止。

激活Firebase日志并不会产生任何错误,但是,使用Chrome检查器,我可以看到cordova浏览器发出.lp?start=...canceled个请求。

该应用程序运行Angular 1.4,Ionic 1.1.0,AngularFire 1.1.3和Firebase 2.2.9。无论版本如何,Android和iPhone都会出现此问题。

我的手机无线网络可以丢弃与网络相关的问题。

这是(可能)相关的JS代码:

var facebookUid = '1213161789'; // result from the facebook native plugin
var ref = new Firebase(config.firebaseurl + '/users');
$firebaseObject(ref.child(facebookUid))
    .$loaded()
    .then(function(firebaseUser) {
       .... // sometimes called
    })
    .catch(function(firebaseUser) {
       .... // never called
    })
;

我试图强制进行长轮询而不是网络套接字,但没有明显的变化。问题最初发生在普通Firebase对象上,切换到AngularFire并没有解决它。

这可能与此无关,但是:

  • 根据文档,我还在config.xml中添加了以下内容
    • <allow-intent href="*.firebaseio.com" />
    • <allow-intent href="auth.firebase.com" />
  • 此行在我的index.html中
    • <meta http-equiv="Content-Security-Policy" content="connect-src *">

以下是启用Firebase日志后的内容:

c:0:3: Primary connection is healthy.
p:0: from server: {"r":15,"b":{"s":"ok","d":{}}}
p:0: listen response {"s":"ok","d":{}}
p:0: from server: {"r":16,"b":{"s":"ok","d":""}}
p:0: p response {"s":"ok","d":""}
p:0: from server: {"r":17,"b":{"s":"ok","d":""}}
p:0: p response {"s":"ok","d":""}
p:0: from server: {"r":18,"b":{"s":"ok","d":""}}
p:0: m response {"s":"ok","d":""}
p:0: Browser went offline.  Killing connection.
c:0:3: Closing realtime connection.
c:0:3: Shutting down all connections 
c:0:3:0 Longpoll is being closed.
p:0: data client disconnected
0: onDisconnectEvents

似乎navigator.online为true,当我们尝试强制连接Firebase.goOnline()时,连接不会恢复...

0 个答案:

没有答案