Copy link to clipboard
Copied
iS IT POSSIBLE TO CALL ADMINISTRATION API METHODS SUCH AS GETSERVERSTATS() etc from server side code....
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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"
Copy link to clipboard
Copied
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
}
}