Skip to main content
Participating Frequently
Feb 23, 2010 11:16 AM UTC
Answered

How to make getServerStats() API call?

How to make getServerStats() API call?

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Janaki Lakshmikanthan
    Janaki LakshmikanthanCorrect answer
    Adobe Employee
    Feb 23, 2010 11:45 AM UTC

    Hi,
    Here you go..

    1. To make rtmp call use the code

    var admin_nc = new NetConnection();
    var callResponder = new Responder(result_callResponder, status_callResponder);

    admin_nc.addEventListener(NetStatusEvent.NET_STATUS, nc_status);
    admin_nc.connect("rtmp://10.192.22.92:1111/admin", "admin", "admin");


    function nc_status(event:NetStatusEvent):void{
    trace("nc status " + event.info.code);
    if(event.info.code=="NetConnection.Connect.Success"){
      admin_nc.call("getServerStats", callResponder);
           
    }

    }

    function result_callResponder(info:Object):void{
    trace("result_callResponder");
    for(var prop in info.data){
      trace("property:" + prop + " - " + info.data[prop]);
    }
    }

    function status_callResponder(eve:Event):void{
    trace("status_callResponder");
    }


    2. To make http call - enter "http://10.192.22.92:1111/admin/getServerStats?

    auser=admin&apswd=admin" in your browser and hit enter. Before that make sure you

    have enabled this command in your users.xml file. To do so, open <installed fms

    dir>/conf/users.xml. Edit the tag "Root > AdminServer > HTTPCommands > Allow" and

    enter the value "All" for it. Save and restart the server, then try the http

    command.

    Regards,
    Janaki L

    7 replies

    Janaki Lakshmikanthan
    Adobe Employee
    Janaki LakshmikanthanCorrect answer
    Adobe Employee
    Feb 23, 2010 11:45 AM UTC

    Hi,
    Here you go..

    1. To make rtmp call use the code

    var admin_nc = new NetConnection();
    var callResponder = new Responder(result_callResponder, status_callResponder);

    admin_nc.addEventListener(NetStatusEvent.NET_STATUS, nc_status);
    admin_nc.connect("rtmp://10.192.22.92:1111/admin", "admin", "admin");


    function nc_status(event:NetStatusEvent):void{
    trace("nc status " + event.info.code);
    if(event.info.code=="NetConnection.Connect.Success"){
      admin_nc.call("getServerStats", callResponder);
           
    }

    }

    function result_callResponder(info:Object):void{
    trace("result_callResponder");
    for(var prop in info.data){
      trace("property:" + prop + " - " + info.data[prop]);
    }
    }

    function status_callResponder(eve:Event):void{
    trace("status_callResponder");
    }


    2. To make http call - enter "http://10.192.22.92:1111/admin/getServerStats?

    auser=admin&apswd=admin" in your browser and hit enter. Before that make sure you

    have enabled this command in your users.xml file. To do so, open <installed fms

    dir>/conf/users.xml. Edit the tag "Root > AdminServer > HTTPCommands > Allow" and

    enter the value "All" for it. Save and restart the server, then try the http

    command.

    Regards,
    Janaki L

    Translate
    vavoottyAuthor
    Participating Frequently
    Feb 24, 2010 8:28 AM UTC

    Can you please post the code in server side for getServerStats()?...thanks very much!!!!!!!!!!!!

    Translate
    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    Feb 25, 2010 4:42 AM UTC

    Hi,

    The above mentioned code is in AS3. Here is the code in AS1 which you can use at server side application

    var admin_nc = new NetConnection();
    admin_nc.connect("rtmp://10.192.22.210:1111/admin", "admin", "admin");

    admin_nc.onStatus = function(info){
      trace("nc status " + info.code);
      if(info.code=="NetConnection.Connect.Success"){
        admin_nc.call("getServerStats", new callResponder() );  
      }
    }

    callResponder = function (){
      this.onResult = function(info){
       trace("callResponder.onResult");
       for(var prop in info.data){
         trace("property:" + prop + " - " + info.data[prop]);
       }
      }

      this.onStatus = function(info){
       trace("callResponder.onStatus");
      }
    }

    Regards,

    Janaki L

    Translate