0

有没有办法使用 now.js 遍历用户组?

当用户断开连接时,我想在他们所属的组上运行一些功能。

类似于此处的答案 1 ( 1 ),但由于某种原因,该代码不起作用。

代码:

nowjs.on('disconnect', function() { 
    var that = this;
    this.getGroups(function(groups){
         for (i=0;i<groups.length;i++){
             nowjs.getGroup(groups[i]).removeUser(that.user.clientId);
             console.log('user removed');
         }
    })
})
4

1 回答 1

0

I forgot that I had already created an array called serverRoomsList. That held, oddly enough, a list of all the chat rooms I had already created. I just looped through that to get all of the group names.

However, I would still like to know if Now itself keeps track of groups in an array, or if I have to do it.

于 2012-12-27T04:28:28.323 回答