Packagenet.user1.reactor.snapshot
Classpublic class ClientListSnapshot
InheritanceClientListSnapshot Inheritance Snapshot Inheritance flash.events.EventDispatcher

Since : Reactor 1.0.0

The ClientListSnapshot class is used to load a list of clientIDs for the clients currently on the server. For any client that is logged in, both a clientID and a userID are included in the list. The following code demonstrates.

   // Create the snapshot
   var snapshot:ClientListSnapshot = new ClientListSnapshot();
   
   // Register a callback function
   snapshot.onLoad = function ():void { 
     // Show the clientID of the first client in the client list
     trace(snapshot.getClientList()[0].clientID);
     // Show the userID of the first client in the client list
     trace(snapshot.getClientList()[0].userID);
   }
   
   // Or register a listener function
   snapshot.addEventListener(SnapshotEvent.LOAD, loadListener);
   function loadListener (e:SnapshotEvent):void {
     // Show the clientID of the first client in the client list
     trace(ClientListSnapshot(e.target).getClientList()[0].clientID);
     // Show the userID of the first client in the client list
     trace(ClientListSnapshot(e.target).getClientList()[0].userID);
   }
   
   // Load the client list by passing the snapshot object to 
   // Reactor's updateSnapshot() method:
   reactor.updateSnapshot(snapshot);
   

The list of client IDs retrieved by ClientListSnapshot is a one-time snapshot of the state of the server, and is not kept up to date after it is loaded. To update a ClientListSnapshot object to match latest the state of the server, pass that object to Reactor's updateSnapshot() method.

See also

Snapshot
net.user1.reactor.Reactor.updateSnapshot()


Public Variables
 VariableDefined By
 InheritedonLoad : Function
A callback function to be invoked when this snapshot's data is loaded.
Snapshot
Public Methods
 MethodDefined By
  
Constructor
ClientListSnapshot
  
Returns an array of generic data objects containing the clientIDs and, for logged in clients, the userIDs of the clients on the server.
ClientListSnapshot
 Inherited
getStatus():String
Returns the status of the most recent snapshot load-operation.
Snapshot
 Inherited
Indicates whether the snapshot is currently loading data.
Snapshot
Events
 Event Summary Defined By
 Inherited Dispatched when a snapshot object has been updated in response to an earlier call to Reactor's updateSnapshot() method.Snapshot
 Inherited Dispatched when the result of an update request has been received by a snapshot object.Snapshot
Constructor Description
ClientListSnapshot()Constructor
public function ClientListSnapshot()

Constructor

Method Descriptions
getClientList()method
public function getClientList():Array

Since : Reactor 1.0.0

Returns an array of generic data objects containing the clientIDs and, for logged in clients, the userIDs of the clients on the server. Each data object has the following structure:

     var o:Object = new Object();
     o["clientID"] = someClientID;
     o["userID"]   = someUserID;
     

For clients that are not logged in, the value of the userID variable is null.

Returns
Array