1

I'm trying to connect to my Socket.IO server, but the connection couldn't be made. It works without HTTPS. I created the pem and crt file with openssl command, I also have opened port 3300 through Firewall.

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('3300');

Calling the server/url.

io('https://example.com:3300');

NodeJS is just as a backend, I'm not using express or anything on there.

1
  • What is being logged by the client/browser?
    – robertklep
    Apr 20, 2017 at 12:46

1 Answer 1

0

Try using,

var socket = io.connect('https://localhost:3300', {secure: true})

UPDATE

Try following the instructions in

How to use HTTPS on Node.js using Express/Socket.io

1
  • did you try the Update ? Apr 20, 2017 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.