如何设置数据库规则,以便浏览器可以收听?
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"
}
}
}
}
}
}
}
该.info/connected
路径是客户端上的一个虚拟节点,反映了套接字连接状态。它始终可用,不受安全规则的影响。
同样.info/serverTimeOffset
也是如此。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句