Signaling server deployment and usage
Initially WebRTC technology was designed for establishing direct connections between web browsers, like it is shown onthe picture below.
The signaling server here is not a part of WebRTC engine, but it is required to initiate the connection and resolve firewall bypassing issues.
We adopted this scheme for MPlatform and MFromats SDK and created the MWebRTC object. It can act as a WebRTC streaming or receiving client. Check this article to get the idea how to use MWebRTC object: [http://docs.medialooks.com/a962d7/ How to get started with WebRTC] .
Here is how it works:
As you see you need to have a signaling server and HTML pages except of MPlatform or MFormats based application to play around with WebRTC.
We have 2 ways to deal with signaling server and test pages:
- The easy one
Go for it if you want to test the WebRTC logic and don't want to spend time for deploying signaling server and HTML pages.
Step 1: use our demo signaling server.
It is available here: https://rtc.medialooks.com:8889
It is set by default for all MPlatform and MFormats objects, so if you've just installed the SDK and using our sample applications, there is no need to do anything else.
Step 2: use local HTML files without a web server.
The files are available here by default:
MPlatform SDK: C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\HTML
MFormats SDK: C:\Program Files (x86)\Medialooks\MFormats SDK\Samples WebRTC\HTML
- The expert one
Go for it if you want to use your own signaling server and deploy HTML pages on your own web server.
Step 1: Run your own signaling server.
Signaling server source code is available in installation package:
- MPlatorm SDK: "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER"
- MFormats SDK: "C:\Program Files (x86)\Medialooks\MFormats SDK\Samples WebRTC\SIGNALING SERVER"
We use [https://github.com/andyet/signalmaster Signalmaster], a Node.js-based signaling server, with some minor modifications. It helps to establish a peer connection between the MWebRTC object and the browser or another MWebRTC object.
To run you own server you need to:
- Install Node.js engine: https://nodejs.org/en/download
- Open a command prompt and navigate to the folder with signaling server (e.g "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER").
- Run "npm install" (Windows user might previously want to install Visual Studio 2013/2015 to avoid missing dependensies during this step).
- Generate test self-signed SSL certificate (cert.pem, key.pem) to allow secure communication with your signaling server and put it in "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER\config\sslcerts" folder. Windows users can do it by using OpenSSL like described [https://msol.io/blog/tech/create-a-self-signe.../ here].
- Run following in command line :
6.start the signaling server
Once you're done with signaling server setup, don't forget to specify signaling server IP in your applications, by default after SDK installation all MWebRTC object will using https://rtc.medialooks.com:8889
signaling_server = https://rtc.medialooks.com:8889
All local WebRTC objects will use this IP by default.
Step 2: Create your local website and deploy the test HTML page there.
Here is the test page location:
- MPlatorm SDK : "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\HTML"
- MFormats SDK: "C:\Program Files (x86)\Medialooks\MFormats SDK\Samples WebRTC\HTML"
Here is the easiest way to create a local website in Windows 7:
- Go to Start -> Control Panel -> Programs and Features -> Turn Windows features on or off, and tick the "Internet Information services" item:
- Generate a self-signed SSL certificate that will be used to access test pages via https. Go to Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS) Manager, double click on "Server Certificates" and then on "Create Self-Signed Certificate"
- In the dialog box type "TestCert" as a friendly name for the certificate and click "OK".
- Now it's to create test site itself. Right click on "Sites" and choose "Add website":
- In the opened window choose the name for your test site. Point to test page folder in the "Physical path" textbox ("C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\HTML"). Select "https" in Bindings section and choose the "TestCert" in SSL certificate section
- Press "OK", and now you have your own test site with an HTML page that can receive a stream from MWebRTCobject. Please note that using IIS for deploying the page isn't mandatory, you can use any engine of your choice.