Package | net.user1.reactor.snapshot |
Class | public class GatewaysSnapshot |
Inheritance | GatewaysSnapshot ![]() ![]() |
Since : | Reactor 2.0.1 |
// 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
Method | Defined By | ||
---|---|---|---|
Constructor
| GatewaysSnapshot | ||
getGateways():Array
Returns an array of Gateway objects providing
information about the gateways on the server. | GatewaysSnapshot | ||
![]() | getStatus():String
Returns the status of the most recent snapshot load-operation. | Snapshot | |
![]() | updateInProgress():Boolean
Indicates whether the snapshot is currently loading data. | Snapshot |
GatewaysSnapshot | () | Constructor |
public function GatewaysSnapshot()
Constructor
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.
ReturnsArray |