Open gitbong opened 7 years ago
现在还不知道问题出在哪里,不过有几点需要注意:
1.
disconnectRef.onDisconnect().set('I disconnected!')
.then(->
console.info('disconnect operation has been executed.')
)
then 执行并不意味着数据已经修改了,而仅仅意味着“这个操作已经委托给服务端了”。
2.
如何获取当前端的在线状态?
wilddog.sync().ref('.info/connected').on('value',function(snapshot){
if(snapshot.val() == true){
//当前在线
}
else{
}
})
3.
可能跟数据设计有关,可以只设置一个在线状态位,而不是在每个channel上都设置一个吧
现在来看,这个例子有点长,能否写个更简单一点的
另外,我测试了这个接口的功能,是OK的,测试的版本是2.3.10 不知道你用的版本是什么
我只用了几行代码测试
wilddog.sync().ref('disconnected').onDisconnect().set('disconnect')
wilddog.sync().ref('disconnected2').onDisconnect().set('disconnect')
wilddog.sync().ref('disconnected3').onDisconnect().set('disconnect')
结果都符合预期
使用场景
我遇到的问题如下,望解答