Hi There,
How can I make my ws connection to wss connection in node js?? After the latest update, chrome has stopped all its HTTP service for getUserMedia activities. So its mandatory to run in HTTPS protocol, I tried with the following modifications to existing kurento one2many call server.js file. I don't get any errors when I run this file and port 8443 is open an d listening. But if I try to send a message or to connect from chrome browser it throws an error.
Can anyone please help me out with this and suggest me some ideas to get through it
Error:
WebSocket connection to 'wss://my.ip.address:8443/call' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED
Modifications :
var path = require('path');
var express = require('express');
var ws = require('ws');
var minimist = require('minimist');
var url = require('url');
var https = require('https');
var fs = require('fs');
var kurento = require('kurento-client');
var privateKey = fs.readFileSync('/path/to/key.pem', 'utf8');
var certificate = fs.readFileSync('path/to/cert.pem', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var argv = minimist(process.argv.slice(2),
{
default:
{
ws_uri: "ws://localhost:8888/kurento"
}
});
var app = express();
/*
* Server startup
*/
var asUrl = url.parse(argv.as_uri);
var httpsServer = https.createServer(credentials, app);
var port = asUrl.port;
httpsServer = app.listen(port, function() {
console.log('Kurento Tutorial started');
console.log('Open ' + url.format(asUrl) + ' with a WebRTC capable browser');
console.log('port' + port);
});
var wss = new ws.Server({
server : httpsServer,
path : '/call'
});
/*
* Management of WebSocket messages
*/
wss.on('connection', function(ws) {
var sessionId = nextUniqueId();
console.log('Connection received');
});
Thank you,
shadanana