Skip to main content
Bijeshcnair
Participating Frequently
June 11, 2009
Question

Calling administration api method

  • June 11, 2009
  • 1 reply
  • 801 views

iS IT POSSIBLE TO CALL ADMINISTRATION API METHODS SUCH AS GETSERVERSTATS() etc from server side code....

    This topic has been closed for replies.

    1 reply

    June 11, 2009

    Yes... it's possible.

    You first need to make a netconnection to the admin service:

    var nc = new NetConnection();

    nc.onStatus = function(info){

    // handle connection status

    }

    nc.connect("rtmp://myfmsserver.com:1111/admin", "admin username", "admin password");

    Then make the calls just like any other netconnection.call

    function onGetServerStats(results){

    // handle results here

    }

    nc.call("getServerStats", onGetServerStats);

    Bijeshcnair
    Participating Frequently
    June 12, 2009

    I'm still facing problem,,

    i need to check the uptime and the number of users connected to the remote server..

    this is my code

    application.onConnect = function(client,name)

    {

         nc_poll=new NetConnection();
         nc_poll.connect("rtmp://abcd.com:1111/admin","usrnmame","password");

    function onGetServerStats(result)
    {
       
               
        var dataobj=result.data;
        trace("on getserver");
        trace(dataobj.up_time);
        trace(result.level);
           
        }

    nc_poll.call("getServerStats",new onGetServerStats);

    }

    // im getting the ongetserver log in the log but the other traced values..

    its showing that

    "result has no properties"

    June 12, 2009

    Sorry... my brain must not have been working quite right yesterday. You need to define onResult and onStatus handlers in the result handler:

    function onGetServerStats(){
    this.onResult = function(info){
    // handle result here
    }
    this.onStatus = function(info){
    // handle errors here
    }
    }