node.js tutorial from http to https

128 views
Skip to first unread message

d.me...@glowbl.com

unread,
Aug 25, 2015, 11:24:52 AM8/25/15
to kurento
Hello,

I'm trying to transform the hello-world node.js tutorial in KMS6, from http to https, in order to try screen sharing.

I've uncommented the config file as follow:

"websocket": {
       
"port": 8888,
       
"secure": {
         
"port": 8433,
         
"certificate": "myCert.pem",
         
"password": ""

In the index.js, instead of the Websocket:

var ws = new WebSocket('wss://<KMS_IP>/helloworld');

And in the server.js:

as_uri: 'https://<KMS_IP>:443/',
ws_uri
: 'wss://<KMS_IP>:8433/kurento'


var options = {
    key
: fs.readFileSync('./server.key'),
    cert
: fs.readFileSync('./server.crt'),
    requestCert
: true,
    passphrase
: ""
};


var server = https.createServer(options, app).listen(port, function() {
        console
.log('Kurento Tutorial started');
        console
.log('Open ' + url.format(asUrl) + ' with a WebRTC capable browser');
});

I can launch the node.js app, and browse to the hello-world index.html page (so the self-signed certificate is good).

When I click on the start button, it throw me this error:

Received message: {"id":"error","message":"Could not find media server at addresswss://<KMS_IP>:8433/kurento. Exiting with error Error: Connection error"}

So it seems that my node.js can't communicate with the kurento media server, I guess.

Did I do something wrong ?

Thanks

Ivan Gracia

unread,
Aug 26, 2015, 12:47:52 PM8/26/15
to Kurento Public
Well yes, you need to configure the certificate in the media server, for one. I don't know if you've done that.

Ivan Gracia



--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

d.me...@glowbl.com

unread,
Aug 27, 2015, 3:05:18 AM8/27/15
to kurento
Hello Ivan,

I followed the "How do I configure KMS to use Secure websocket" part found here. I've generated a certificate, and linked it inside the /etc/kurento/kurento.conf.json.
"websocket": {
       
"port": 8888,
       
"secure": {
         
"port": 8433,
         
"certificate": "myCert.pem",
         
"password": ""

I can't see what I missed

Ivan Gracia

unread,
Aug 27, 2015, 5:49:04 AM8/27/15
to Kurento Public
Could it be that you are mixing connections and IPs? Your connections should be

client --------------------- node.js app ------------- KMS
             wss/https                               ws

Is this what you want to achieve? If that's the case, then you don't need to change anything in KMS, just in your node.js app, so it serves the app through a secure connection.

Ivan Gracia


d.me...@glowbl.com

unread,
Aug 27, 2015, 6:04:57 AM8/27/15
to kurento
You were right, I was mixing connections. Your representation was very helpfull ;)

I changed ws_uri: 'wss://<KMS_IP:8433>/kurento' by ws_uri: 'ws://<KMS_IP:8888>/kurento' and it worked.

But I don't understand. The communication between KMS and the client is not secure ? Or does it use the port 8433 defined in the config file to stay secure ?

Thanks for your help :)

Ivan Gracia

unread,
Aug 27, 2015, 6:11:42 AM8/27/15
to Kurento Public
The client, in your setup, only connect with the server in the media plane. WS are used for signalling. The following image should give you a better idea. It's from the introduction part of the documentation. Please read that chapter, as it will really solve a lot of setup questions like the one you were having. 


Inline image 1\

Cheers,

Ivan Gracia


Reply all
Reply to author
Forward
0 new messages