How to regularly get the number of connected clients?

Hello

-Version: 5.5.2-944 (Amazon AWS)
-WebSDK: 2.0.170

Is there a way to regularly get the number of connected clients to show (maybe update every minute) in my Vue.js based webapp?


Best,
Thomas
 
Hey

I jave another question (searched the docs but didn't find anything), how can i limit the results to only one stream i.e. "test"? So not the total number of connections and the stream state should be returned, but only the results for "test".
 

Max

Administrator
Staff member
I jave another question (searched the docs but didn't find anything), how can i limit the results to only one stream i.e. "test"? So not the total number of connections and the stream state should be returned, but only the results for "test"
You can use stream viewers stats:
Code:
http://host:8081/?action=stat&params=streams_viewers
This returns the following:
Code:
-----Stream Stats-----
streams_viewers=test/1;qwerty/1
Then search for stream name, and parse connections number per stream after / character.
 

Max

Administrator
Staff member
Is there any way i can filter via REST API or JSON?
You can get the result as JSON:
Code:
http://host:8081/?action=stat&params=streams_viewers&format=json
The result in this case will look like this:
Code:
{
  "streams_stats": {
    "streams_viewers": [
      "test/1",
      "qwerty/1"
    ]
  }
}
 
Top