【问题标题】:Do I need to set Firebase permissions for db.ref('.info/connected');?我需要为 db.ref('.info/connected'); 设置 Firebase 权限吗?
【发布时间】:2016-09-02 10:48:47
【问题描述】:

如何设置我的数据库规则以便浏览器可以收听?

var connectedRef = db.ref('.info/connected');
connectedRef.on('value', function(snap) {...});

目前尚不清楚我将设置什么级别才能收听.info/connected

这是我当前的数据库规则:

{
  "rules": {
    "service": {
      "$service": {
        "bot": {
          "$bot_id": {
            "notification": {
              "$user_id": {
                ".write": "auth != null"
              }
            },
            "player": {
              ".write": "auth != null",
              ".read": "auth != null"
            }
          }
        }
      }
    }
  }
}

【问题讨论】:

  • 你当前的数据库规则是什么?
  • @ChintanSoni 当前数据库规则见上文。刚刚将它们添加到问题中。

标签: javascript firebase firebase-realtime-database firebase-authentication firebase-security


【解决方案1】:

.info/connected 路径是客户端上反映套接字连接状态的虚拟节点。它始终可用,不受安全规则的影响。

.info/serverTimeOffset 也是如此。

【讨论】:

  • 很好的答案@vzsg!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多