How can I reach the number of instant viewers?

burak guder

Member
I use the rest api system on flashphoner.

After creating a new stream, I want to get the stream based instant viewer count via rest api.

When I use these "/connection/find" and "/connection/find_all", they return me a lot of data.

Thanks for your help
 

Max

Administrator
Staff member
Good day.
You can use HTTP GET query
Code:
http://wcs:8081/?action=stat&params=streams_viewers&format=json
It will return viewers count per stream, for example
Code:
{"streams_stats":{"streams_viewers":["test/1"]}}
 

Ibrahim

New Member
Good day.
You can use HTTP GET query
Code:
http://wcs:8081/?action=stat&params=streams_viewers&format=json
It will return viewers count per stream, for example
Code:
{"streams_stats":{"streams_viewers":["test/1"]}}
Do you know how can I enable CORS for that request?
 

Ibrahim

New Member
Good day.

Please read here.
I did try that but not working
first I went to this file
Code:
/usr/local/FlashphonerWebCallServer/conf/falshphoner.properties
and my file look like this:
Code:
ip=**.***.***.***

ip_local=***.**.**.***

client_mode=false

rtc_ice_add_local_component=true

rest_access_control_allow_origin=*
rest_access_control_allow_headers=content-type,x-requested-with
rest_access_control_allow_methods=POST
EDIT:
The request is sent to: https://SERVER_URL.com:8444/?action=stat&params=streams_viewers&format=json
 

Ibrahim

New Member
Please provide a sample webpage showing how do you perform the request using this form.
Thanks for your response. I did attach screenshot of my code.
Using postman or Javascript Fetch function or any http method.
The response header is same without CORS enabled.

Every edit I made I restart the service and the server after.
 

Max

Administrator
Staff member
Try to add server-side setting flashphoner.properties
Code:
load_balancing_acao_header=*

This setting should result to header:
Code:
Access-Control-Allow-Origin: *
1641902614035.png
 
Top