Packagenet.user1.reactor.snapshot
Classpublic class GatewaysSnapshot
InheritanceGatewaysSnapshot Inheritance Snapshot Inheritance flash.events.EventDispatcher

Since : Reactor 2.0.1

The GatewaysSnapshot class is used to retrieve a per-gateway summary of connection and bandwidth statistics. By default, access to gateway data requires administrator privileges.
   // Create a snapshot to load information about gateways on the server
   var snapshot:GatewaysSnapshot = new GatewaysSnapshot();
   
   // Register a callback function
   snapshot.onLoad = function ():void { 
     // Display details for each gateway on the server
     var gateways:Array = snapshot.getGateways();
     for (var i:int = 0; i < gateways.length; i++) {
       trace("\nGateway ID: " + Gateway(gateways[i]).id);
       trace("Gateway type: " + Gateway(gateways[i]).type);
       trace("Lifetime connections by category:");
       var lifetimeConnectionsByCategory:Object = Gateway(gateways[i]).lifetimeConnectionsByCategory;
       for (var p:String in lifetimeConnectionsByCategory) {
         trace("    " + p + ": " + lifetimeConnectionsByCategory[p]);
       }
       trace("Lifetime clients by type:");
       var lifetimeClientsByType:Object = Gateway(gateways[i]).lifetimeClientsByType;
       for (p in lifetimeClientsByType) {
         trace("    " + p + ": " + lifetimeClientsByType[p]);
       }
       trace("Lifetime clients by UPC version:");
       var lifetimeClientsByUPCVersion:Object = Gateway(gateways[i]).lifetimeClientsByUPCVersion;
       for (p in lifetimeClientsByUPCVersion) {
         trace("    " + p + ": " + lifetimeClientsByUPCVersion[p]);
       }
       trace("Attributes:");
       var attributes:Object = Gateway(gateways[i]).attributes;
       for (p in attributes) {
         trace("    " + p + ": " + attributes[p]);
       }
       trace("Connections per second: " + Gateway(gateways[i]).connectionsPerSecond);
       trace("Max connections per second: " + Gateway(gateways[i]).maxConnectionsPerSecond);
       trace("Clients per second: " + Gateway(gateways[i]).clientsPerSecond);
       trace("Max clients per second: " + Gateway(gateways[i]).maxClientsPerSecond);
       trace("Bandwidth (in bytes): ");
       trace("    Lifetime read: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).lifetimeRead);
       trace("    Lifetime written: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).lifetimeWritten);
       trace("    Average read: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).averageRead);
       trace("    Average written: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).averageWritten);
       trace("    Interval read: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).intervalRead);
       trace("    Interval written: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).intervalWritten);
       trace("    Max interval read: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).maxIntervalRead);
       trace("    Max interval written: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).maxIntervalWritten);
       trace("    Scheduled to be written: " + GatewayBandwidth(Gateway(gateways[i]).bandwidth).scheduledWrite);
     }
   }
   
   // Or register a listener function
   snapshot.addEventListener(SnapshotEvent.LOAD, function (e:SnapshotEvent):void {
     // Paste code from onLoad function body here...
   });
   
   // Load the data by passing the snapshot object to 
   // Reactor's updateSnapshot() method:
   reactor.updateSnapshot(snapshot);
   

GatewaysSnapshot represents a one-time snapshot of the state of the server, and is not kept up to date after it is loaded. To update a GatewaysSnapshot object to match latest the state of the server, pass that object to Reactor's updateSnapshot() method.

See also

SnapshotEvent
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
GatewaysSnapshot
  
getGateways():Array
Returns an array of Gateway objects providing information about the gateways on the server.
GatewaysSnapshot
 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
GatewaysSnapshot()Constructor
public function GatewaysSnapshot()

Constructor

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

Since : Reactor 2.0.1

Returns an array of Gateway objects providing information about the gateways on the server.

Returns
Array