Packagecom.akamai.netSession
Classpublic class NetSessionInterface
InheritanceNetSessionInterface Inheritance com.akamai.netSession.BaseInterface

NetSessionInterface is a helper class to make it easy to detect, use and install NetSession(NS). You do that by issuing a check() and optionally download() This class should not be used by plugins, it should be used by the loading app. You should call destroy when done with his class.
      nsi=new NetSessionInterface();
        nsi.addEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSIPresent);
        nsi.check(); }
        
        private function onNSIPresent(evt:NetSessionPresentEvent):void {
            nsi.removeEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSIPresent);
            if (!evt.available)    {
                trace("we don't have NetSession (NS)");
                nsi.download(); 
                 nsi.addEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSPresentLater);
                nsi.check(35);     }
            else if (evt.available){
                trace("we have NS");
                nsi.addEventListener(ClientAttributesEvent.CLIENTATTRIBUTES_EVENT, onAttributes);
                nsi.requestClientAttributes();
                nsi.addEventListener(PerformanceAttributesEvent.PERFORMANCEATTRIBUTES_EVENT, onPerf);
                nsi.requestPerformanceAttributes();    } //fi
        } //()
        
        private function onNSPresentLater(evt:NetSessionPresentEvent):void{
            if (evt.available)    {
                nsi.removeEventListener(NetSessionPresentEvent.NETSESSION_PRESENT, onNSPresentLater);
                trace("now we have NS");    } //fi
        } //()

        private function onPerf(evt:PerformanceAttributesEvent):void{
            trace('onPerf', evt.cpu);}
    
        private function onAttributes(evt:ClientAttributesEvent):void{
            trace('onAtt',  evt.peerUploadRatio, evt.shareRate, evt.uploadPauseUntil, evt.version);}
     



Public Methods
 MethodDefined By
  
NetSessionInterface
  
check(times:uint = 1, interval:uint = 333):void
Checks to see if NS is installed.
NetSessionInterface
  
destroy():void
Call this when done with this class.
NetSessionInterface
  
download(type:String = web):void
Start downloading NetSession in the background.
NetSessionInterface
  
This will dispatch ClientAttributesEvent.
NetSessionInterface
  
Dispatches PerofmranceAttributgesEvent with information on CPU utilization.
NetSessionInterface
Events
 Event Summary Defined By
  Find out all the information we have on the installed NetSession client.NetSessionInterface
  Dispatched when the class detects a change in the presence of the Akamai NetSession.NetSessionInterface
  Used to monitor CPUNetSessionInterface
Constructor Detail
NetSessionInterface()Constructor
public function NetSessionInterface()



Method Detail
check()method
public function check(times:uint = 1, interval:uint = 333):void

Checks to see if NS is installed. Default checks once, or you can use arguments to keep checking - for example while downloading the Interface, in order to be notified once the end user has installed NS. Arguments:

Parameters

times:uint (default = 1) — if specified, the number of times to check, default is 1 time.
 
interval:uint (default = 333) — how long to wait in ms in between checks, default is 333 ms which is 3 times per second. You should check for at least 5-10 minutes for the install to be done.

destroy()method 
public function destroy():void

Call this when done with this class.

download()method 
public function download(type:String = web):void

Start downloading NetSession in the background. This should be done after a mouse click or similar, for example a user clicked "Install" button. When using Air, you should use the AirNetSessionInstall - currently a separate library. Argument not currently used, but may be used in the future.

Parameters

type:String (default = web)

requestClientAttributes()method 
public function requestClientAttributes():void

This will dispatch ClientAttributesEvent.

requestPerformanceAttributes()method 
public function requestPerformanceAttributes():void

Dispatches PerofmranceAttributgesEvent with information on CPU utilization.

Event Detail
clientAttributes Event
Event Object Type: com.akamai.netSession.events.ClientAttributesEvent

Find out all the information we have on the installed NetSession client.

netSessionPresent Event  
Event Object Type: com.akamai.netSession.events.NetSessionPresentEvent

Dispatched when the class detects a change in the presence of the Akamai NetSession.

performanceAttributes Event  
Event Object Type: com.akamai.netSession.events.PerformanceAttributesEvent

Used to monitor CPU