Package | net.user1.reactor.snapshot |
Class | public class ClientListSnapshot |
Inheritance | ClientListSnapshot ![]() ![]() |
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
Method | Defined By | ||
---|---|---|---|
Constructor
| ClientListSnapshot | ||
getClientList():Array
Returns an array of generic data objects containing the clientIDs and,
for logged in clients, the userIDs of the clients on the server. | ClientListSnapshot | ||
![]() | getStatus():String
Returns the status of the most recent snapshot load-operation. | Snapshot | |
![]() | updateInProgress():Boolean
Indicates whether the snapshot is currently loading data. | Snapshot |
ClientListSnapshot | () | Constructor |
public function ClientListSnapshot()
Constructor
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.
ReturnsArray |