Wednesday, 19 April 2017

Cannot connect to Socket.IO HTTPS

I'm using HTTPS so I have to use HTTPS for socket.io as well but I just can't get it working.

Here is the code what I used. Cert files are created by openssl command(s)

var https = require('https');
var options = {
  key: fs.readFileSync('file.pem'),
  cert: fs.readFileSync('file.crt')
};
var app = https.createServer(options);
io.listen(app); app.listen('8080');

Then added my host aka ip of the server to the client system js file and tried to call it like that:

io(HOST, {secure: true});



via Jordn

No comments:

Post a Comment