Skip to main content
Participating Frequently
February 23, 2010
Answered

How to make getServerStats() API call?

  • February 23, 2010
  • 1 reply
  • 1385 views

How to make getServerStats() API call?

    This topic has been closed for replies.
    Correct answer Janaki Lakshmikanthan

    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

    1 reply

    Janaki Lakshmikanthan
    Adobe Employee
    Janaki LakshmikanthanCorrect answer
    Adobe Employee
    February 23, 2010

    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

    vavoottyAuthor
    Participating Frequently
    February 24, 2010

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

    Janaki Lakshmikanthan
    Adobe Employee
    Adobe Employee
    February 25, 2010

    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