Group.now not synced?

38 views
Skip to first unread message

Ben Corne

unread,
Jul 7, 2012, 6:37:39 AM7/7/12
to no...@googlegroups.com
Hello again

This time I'm here with a question regarding group's .now property.

Here's the scenario:
A user logs in, sits in the lobby and joins a room.
This operation adds him to the now.js#Group of the room, emitting a join event by now.js itself;
This event is captured and the group is notified of a new group member: mygroup.now.receiveRoomMessage(user.name+' joined the room.')

On the client side, the now object has getters and setters for receiveRoomMessage, however, when I log the serverside group's now: console.log(mygroup.now) it always prints an empty object.
After multiple joins it still stays empty so it's not like the method isn't propagated yet.

Any clues?

Kind regards
Ben

Ben Corne

unread,
Jul 9, 2012, 3:33:46 AM7/9/12
to no...@googlegroups.com
A bit of clarification:
The example from examples/multiroomchat_example
-----------------
everyone.now.changeRoom = function(newRoom){
  this.now.distributeMessage("[leaving " + this.now.room + "]");
  nowjs.getGroup(this.now.room).removeUser(this.user.clientId);
  nowjs.getGroup(newRoom).addUser(this.user.clientId);
  this.now.room = newRoom;
  this.now.distributeMessage("[entering " + this.now.room + "]");
  var that = this;
  nowjs.getGroup(this.now.room).count(function(count){
    var prettyCount = (count === 1) ? "Room is empty." : (count - 1) + " other(s) in room.";
    that.now.receiveMessage("SERVER", "You're now in " + that.now.room + ". " + prettyCount);
  });
}

everyone.now.distributeMessage = function(message){
  nowjs.getGroup(this.now.room).now.receiveMessage(this.now.name, message);
};
-------------------
To me, this means that a group object's now should be able to perform now calls just like on the everyone group.

I'm building a smaller example than the one I'm working on so I can share easily.

Ian Serlin

unread,
Jul 9, 2012, 4:16:23 PM7/9/12
to no...@googlegroups.com
Hey Ben,

Are you saying that the functionality doesn't work or that the group's now object looks empty when you do a console.log? Or both?
Reply all
Reply to author
Forward
0 new messages