新的Firebase失败:第一个自变量必须是有效的Firebase URL,并且路径中不能包含“.",“#","$","["或“]". [英] New Firebase failed: First argument must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]"

查看:51
本文介绍了新的Firebase失败:第一个自变量必须是有效的Firebase URL,并且路径中不能包含“.",“#","$","["或“]".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firebase检查状态,但是控制台抛出以下错误:

I am using Firebase to check presence, but the console throws up the following error:

New Firebase failed: First argument must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".

以下是代码:

new Firebase("https://123654789.firebaseio.com/123654/.info/connected").on('value', function(connectedSnap) {
  console.log(connectedSnap.val());
  if (connectedSnap.val() === true) {
    alert('I am connected!');
  } else {
    /* we're disconnected! */
    alert('not connected!');
  }
});

推荐答案

.info/connected 路径仅存在于Firebase数据的顶层.您不能从子节点访问它.

The .info/connected path only exists on the top-level of your Firebase data. You cannot access it from child nodes.

所以改变

new Firebase("https://123654789.firebaseio.com/123654/.info/connected")

收件人

new Firebase("https://123654789.firebaseio.com/.info/connected")

错误消息将消失.

这篇关于新的Firebase失败:第一个自变量必须是有效的Firebase URL,并且路径中不能包含“.",“#","$","["或“]".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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