Documentation generator: JsDoc Toolkit 2.4.0
Template: Codeview 1.2
Generated on: 2011-6-22 12:26

Class User

Represents an individual user connected to the now server. Exposed as the context in which group.now functions are called, as well as the context in which the callback to nowjs.getClient is executed. Each user has the User#now and User#user namespaces.

Class Summary
Constructor Attributes Constructor Name and Description
 
User()
Field Summary
Field Attributes Field Name and Description
 
The user's Socket.IO socket.

Method Summary

Method Attributes Method Name and Description
 
getGroups(callback)
Used to retrieve a list of the group names corresponding to all groups the user is in.

Class Detail

User()
See:
Group#addUser
Group#removeUser
Now#getClient

Field Detail

{Socket} socket
The user's Socket.IO socket.

Method Detail

  • getGroups(callback)
    Used to retrieve a list of the group names corresponding to all groups the user is in.
    everyone.now.broadcast = function (message) {
    var name = this.now.name;
    this.getGroups(function (groups) {
      for (var i = groups.length; i--;) {
        if (groups[i] !== 'everyone') {
          nowjs.getGroup(groups[i]).now.receive(name, message);
        }
      }
    });
    Parameters:
    {Function} callback
    Called with an Array of Strings corresponding to the various group names.