• How to get connection counts for server, applications, and application instances sent to a Flash application (ModuleGetConnectionCount)

    The following module can be used to return, by name, a combined connection count of all applications on Wowza Streaming Engine™ or for an individual application, application instance, or stream. It will also return a list of client IDs connected to a particular stream name. It will return this information to a custom Flash client that is configured to request and process the information.

    Note: ModuleGetConnectionCount only reports RTMP counts and does not count HTTP or RTSP connections.
    A compiled version of this module is included in the Wowza Module Collection.

    Configuration



    To enable this module, add the following module definition to your application. See Configure modules for details.

    Name
    Description
    Fully Qualified Class Name
    ModuleGetConnectionCount Get connection counts. com.wowza.wms.plugin.collection.module.ModuleGetConnectionCount

    Flash Client Configuration



    The following examples show how to call this module from a custom Flash client by using AS2 or AS3 actionscript.

    AS2 client-side code:
    var ncServerResults = new Object()
    ncServerResults.onResult = function(count:Number)
    {
    	trace("server: "+count);
    }
    nc.call("getServerConnectionCount", ncServerResults);
    
    var ncApplicationResults = new Object()
    ncApplicationResults.onResult = function(count:Number)
    {
    	trace("application: "+count);
    }
    nc.call("getApplicationConnectionCount", ncApplicationResults);
    
    var ncAppInstanceResults = new Object()
    ncAppInstanceResults.onResult = function(count:Number)
    {
    	trace("appInstance: "+count);
    }
    nc.call("getApplicationInstanceConnectionCount", ncAppInstanceResults);
    
    var streamName:String = "myStream";
    
    var ncStreamResults = new Object()
    ncStreamResults.onResult = function(count:Number)
    {
    	trace("stream: "+count);
    }
    nc.call("getStreamConnectionCount", ncStreamResults, streamName);
    
    var ncStreamListResults = new Object()
    ncStreamListResults.onResult = function(list:Array)
    {
    	trace("clients");
    	for(var i:Number=0;i<list.length;i++)
    		trace("["+i+"]: "+list[i]);
    }
    nc.call("getStreamClientIds", ncStreamListResults, streamName);
    AS3 client-side code:
    var ncServerResults = new Object()
    ncServerResults.onResult = function(count:Number)
    {
    	trace("server: "+count);
    }
    nc.call("getServerConnectionCount", new Responder(ncServerResults.onResult));
    
    var ncApplicationResults = new Object()
    ncApplicationResults.onResult = function(count:Number)
    {
    	trace("application: "+count);
    }
    nc.call("getApplicationConnectionCount", new Responder(ncApplicationResults.onResult));
    
    var ncAppInstanceResults = new Object()
    ncAppInstanceResults.onResult = function(count:Number)
    {
    	trace("appInstance: "+count);
    }
    nc.call("getApplicationInstanceConnectionCount", new Responder(ncAppInstanceResults.onResult));
    
    var streamName:String = "myStream";
    
    var ncStreamResults = new Object()
    ncStreamResults.onResult = function(count:Number)
    {
    	trace("stream: "+count);
    }
    nc.call("getStreamConnectionCount", new Responder(ncStreamResults.onResult), streamName);
    
    var ncStreamListResults = new Object()
    ncStreamListResults.onResult = function(list:Array)
    {
    	trace("clients");
    	for(var i:Number=0;i<list.length;i++)
    		trace("["+i+"]: "+list[i]);
    }
    nc.call("getStreamClientIds", new Responder(ncStreamListResults.onResult), streamName);

    Wowza media server software and all components, including modules, source code, and other related items offered on this page, are copyrighted (c) 2006-2014 by Wowza Media Systems, LLC, all rights reserved, and are licensed pursuant to the Wowza Media Software End User License Agreement.
    Updated: For Wowza Streaming Engine 4.0.6 on 08-11-2014

    If you're having problems or want to discuss this article, post in our forum.