Skip to main content
Bijeshcnair
Participating Frequently
Jun 11, 2009 12:23 PM UTC
Question

Calling administration api method

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

    This topic is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Jun 11, 2009 1:15 PM UTC

    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);

    Translate
    Bijeshcnair
    Participating Frequently
    Jun 12, 2009 6:20 AM UTC

    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"

    Translate
    Jun 12, 2009 2:06 PM UTC

    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
    }
    }

    Translate