a few questions, webrtc

Max

Administrator
Staff member
1. How can I make a broadcast one to one?
If you want to broadcast a stream to only one subscriber, you can:
- generate an unique stream name in your streaming application (look to Streamer sample web application that ships with WCS)
- provide this stream name to your subscriber application (look to Player sample web application)
- control your streaming on backend (see below)
2. How can I protect the server to allow webrtc stream only from my VPS (ip)
You can allow (or deny) streaming by domain using REST hooks as described here (with full backend script source code).
Also, with REST hooks you can control how subscriber get access to the stream. For example, you can implement /playStream REST hook to reject all requests to play the stream that is already played to one subscriber.
 

salur.webdev

New Member
I don't understand the second answer. For example, using js executes Flashphoner.createSession ({urlServer: 'wss: //wcs1.my-domain.com: 8443'}) i.e. create stream, at this point the WCS server sends me a response to my webhook? I do not understand how I can secure that no one outside my domain can create a stream. I use laravel + vue. I don't uderstand how can I control streaming on backend.
 
Last edited:

Max

Administrator
Staff member
Hello.
For example, using js executes Flashphoner.createSession ({urlServer: 'wss: //wcs1.my-domain.com: 8443'}) i.e. create stream, at this point the WCS server sends me a response to my webhook?
When you create a session and connect to WCS, it sends REST hook /connect to the backend (by default it is embedded EchoApp).
When you play a stream (session.createStream(options).play()), WCS sends REST hook /playStream to the backend. When stream is PENDING, PLAYING, STOPPED or FAILED, WCS sends /StreamStatusEvent to the backend, and so on.
Please read the REST hook documentation. On this page, you'll find REST hook implementation example for authorizinig users by domain, with full PHP script source code. No frameworks, just a plain PHP5.
 

salur.webdev

New Member
Hello @Max,
I used command
update app -l "https://mysite.com/rest-hooks" defaultApp

Now I can't Flashphoner.createSession, in server_logs/flashphoner.log is:

11:38:40,466 ERROR RestClient - API-ASYNC-pool-12-thread-18 Got exception in REST
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I have my domain certificates imported.
You can help me?
 
Last edited:

Max

Administrator
Staff member
Hello.
This message means that WCS cannot connect to backend web server https://mysite.com due to invalid web server certificates.
You should import your domain certificates to WCS and set up domain certificates on your backend web server.
 

salur.webdev

New Member
@Max
ok now works.
Is it possible to check how many people are currently watching the broadcast? I would like to do an online counter.
 
Last edited:

Max

Administrator
Staff member
Hello.
Is it possible to check how many people are currently watching the broadcast? I would like to do an online counter.
You should implement /playStream REST hook. Then, your backend server can count /playStream requests for certain stream by its name.
 
Top