Meteor 我能得到流星的最早时间点。user()

Meteor 我能得到流星的最早时间点。user(),meteor,Meteor,我想将我的用户状态更新为在线,这意味着运行此代码(咖啡脚本…) 我不知道把它放在哪里,(可以把它放在客户机中吗?)即使用户以前已经登录,这个代码在登录的用户身上运行到哪里 通过小小的谷歌搜索,我发现meteor start事件不是发生在什么地方,发生在什么地方?Deps.autorun块中的客户端可以做到这一点 在js中,它类似于 Deps.autorun(function(){ if(Meteor.user()){ Meteor.users.update(Meteor.us

我想将我的用户状态更新为在线,这意味着运行此代码(咖啡脚本…)

我不知道把它放在哪里,(可以把它放在客户机中吗?)即使用户以前已经登录,这个代码在登录的用户身上运行到哪里


通过小小的谷歌搜索,我发现meteor start事件不是发生在什么地方,发生在什么地方?

Deps.autorun块中的客户端可以做到这一点

在js中,它类似于

Deps.autorun(function(){
   if(Meteor.user()){
       Meteor.users.update(Meteor.userId(),{$set:{<your fields here>}});
   }
});
Deps.autorun(函数(){
if(Meteor.user()){
Meteor.users.update(Meteor.userId(),{$set:{});
}
});
--

如果您正在尝试检测用户是否在线,并且可以使用meteorite,您可能需要签出


您也可以自己启动,每10秒左右设置一个
Meteor.setInterval
呼叫,为用户更新
lastSeen
时间,然后检测用户是否在线,如果
lastSeen>timeNow-userTimeout[60秒?]

它不工作。。。我在计算上遇到了一个未经考虑的异常。Calc将尝试设置超时的方法,尽管这不是完美的解决方案
Deps.autorun(function(){
   if(Meteor.user()){
       Meteor.users.update(Meteor.userId(),{$set:{<your fields here>}});
   }
});